Skip to content

Commit

Permalink
fix: ensure there's no reactive tracking in an on_cleanup (closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
gbj authored Oct 12, 2023
1 parent f3508ce commit 17b3300
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions leptos_reactive/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,14 @@ impl Runtime {
pub(crate) fn cleanup_node(&self, node_id: NodeId) {
// first, run our cleanups, if any
let c = { self.on_cleanups.borrow_mut().remove(node_id) };
// untrack around all cleanups
let prev_observer = self.observer.take();
if let Some(cleanups) = c {
for cleanup in cleanups {
cleanup();
}
}
self.observer.set(prev_observer);

// dispose of any of our properties
let properties = { self.node_properties.borrow_mut().remove(node_id) };
Expand Down

0 comments on commit 17b3300

Please sign in to comment.