fix: Read value from root when calling AtomState::current() (#1609)

This commit is contained in:
Marc Espín 2023-11-04 19:22:47 +01:00 committed by GitHub
parent a3e6d0adca
commit bb5738a0ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -86,7 +86,9 @@ impl<T: 'static> AtomState<T> {
/// ```
#[must_use]
pub fn current(&self) -> Rc<T> {
self.value.as_ref().unwrap().clone()
let atoms = self.root.atoms.borrow();
let slot = atoms.get(&self.id).unwrap();
slot.value.clone().downcast().unwrap()
}
/// Get the `setter` function directly without the `AtomState` wrapper.