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:
1 parent
24d247dc85
commit
b6dc2a2230
18 files changed
+459
-250
No files matched your search
@@ -9,7 +9,7 @@ use std::{
|
||||
|
||||
use generational_box::{AnyStorage, Owner, SyncStorage, UnsyncStorage};
|
||||
|
||||
use crate::{innerlude::current_scope_id, ScopeId};
|
||||
use crate::{innerlude::current_scope_id, Runtime, ScopeId};
|
||||
|
||||
/// Run a closure with the given owner.
|
||||
///
|
||||
@@ -91,12 +91,6 @@ pub fn current_owner<S: AnyStorage>() -> Owner<S> {
|
||||
impl ScopeId {
|
||||
/// Get the owner for the current scope.
|
||||
pub fn owner<S: AnyStorage>(self) -> Owner<S> {
|
||||
match self.has_context() {
|
||||
Some(rt) => rt,
|
||||
None => {
|
||||
let owner = S::owner();
|
||||
self.provide_context(owner)
|
||||
}
|
||||
}
|
||||
Runtime::with_scope(self, |cx| cx.owner::<S>()).expect("to be in a dioxus runtime")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user