Skip to content

Commit

Permalink
Faster effects (#159)
Browse files Browse the repository at this point in the history
* Do not clear old dependencies on initial

* Subscribe/unsubscribe signals only belonging to diff

* Revert "Subscribe/unsubscribe signals only belonging to diff"

This reverts commit db0ef30.
  • Loading branch information
lukechu10 authored Jul 8, 2021
1 parent a68f6c9 commit f8f0e3d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/sycamore/src/rx/effect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,6 @@ pub fn create_effect_initial<R: 'static>(
// the effect.
let running = running.upgrade().unwrap();

// Recreate effect dependencies each time effect is called.
running.borrow_mut().as_mut().unwrap().clear_dependencies();

// Push new reactive scope.
contexts.borrow_mut().push(Rc::downgrade(&running));

Expand All @@ -196,6 +193,9 @@ pub fn create_effect_initial<R: 'static>(
});
running.borrow_mut().as_mut().unwrap().scope = scope;
} else {
// Recreate effect dependencies each time effect is called.
running.borrow_mut().as_mut().unwrap().clear_dependencies();

// Destroy old effects before new ones run.

// We want to destroy the old scope before creating the new one, so that
Expand Down

0 comments on commit f8f0e3d

Please sign in to comment.