Deduplicate reactive scope updates/Reset subscriptions on reruns/fix use memo double update (#2506)

* deduplicate effect updates

* only subscribe to signals read in the current run of reactive scopes

* subscribe to memo reads after recomputing the value
This commit is contained in:
Evan Almloff authored and GitHub committed 2024-06-18 18:49:25 -07:00
1 parent 24d247dc85
commit b6dc2a2230
18 files changed
+459 -250

No files matched your search

+2 -2
View File
@@ -1,4 +1,4 @@
use crate::{write::Writable, ReactiveContext};
use crate::write::Writable;
use std::hash::Hash;
use crate::read::Readable;
@@ -57,7 +57,7 @@ impl<R: Eq + Hash, S: Storage<SignalData<bool>>> SetCompare<R, S> {
spawn(async move {
loop {
// Recompute the value
rc.run_in(&mut recompute);
rc.reset_and_run_in(&mut recompute);
// Wait for context to change
let _ = changed.next().await;