mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-26 22:20:19 +00:00
fix: Read value from root when calling AtomState::current()
(#1609)
This commit is contained in:
parent
a3e6d0adca
commit
bb5738a0ba
1 changed files with 3 additions and 1 deletions
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue