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

This commit is contained in:
Marc Espín authored and GitHub committed 2023-11-04 13:22:47 -05:00
1 parent a3e6d0adca
commit bb5738a0ba
1 file changed
+3 -1
+3 -1
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.