mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-23 20:53:06 +00:00
add DirtyAll to SchedulerMsg
This commit is contained in:
parent
d4dda577d6
commit
fe5c698c09
2 changed files with 10 additions and 4 deletions
|
@ -125,6 +125,9 @@ pub enum SchedulerMsg {
|
||||||
/// Immediate updates from Components that mark them as dirty
|
/// Immediate updates from Components that mark them as dirty
|
||||||
Immediate(ScopeId),
|
Immediate(ScopeId),
|
||||||
|
|
||||||
|
/// Mark all components as dirty and update them
|
||||||
|
DirtyAll,
|
||||||
|
|
||||||
/// New tasks from components that should be polled when the next poll is ready
|
/// New tasks from components that should be polled when the next poll is ready
|
||||||
NewTask(ScopeId),
|
NewTask(ScopeId),
|
||||||
}
|
}
|
||||||
|
@ -407,6 +410,11 @@ impl VirtualDom {
|
||||||
SchedulerMsg::Immediate(s) => {
|
SchedulerMsg::Immediate(s) => {
|
||||||
self.dirty_scopes.insert(s);
|
self.dirty_scopes.insert(s);
|
||||||
}
|
}
|
||||||
|
SchedulerMsg::DirtyAll => {
|
||||||
|
for id in self.scopes.scopes.borrow().keys() {
|
||||||
|
self.dirty_scopes.insert(*id);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use captuered_context::CapturedContext;
|
use captuered_context::CapturedContext;
|
||||||
use dioxus_core::{NodeFactory, SchedulerMsg, ScopeId, VNode};
|
use dioxus_core::{NodeFactory, SchedulerMsg, VNode};
|
||||||
use dioxus_hooks::UnboundedSender;
|
use dioxus_hooks::UnboundedSender;
|
||||||
use error::Error;
|
use error::Error;
|
||||||
use interperter::build;
|
use interperter::build;
|
||||||
|
@ -108,9 +108,7 @@ impl RsxContext {
|
||||||
let mut write = self.data.write().unwrap();
|
let mut write = self.data.write().unwrap();
|
||||||
write.hm.insert(loc, text);
|
write.hm.insert(loc, text);
|
||||||
if let Some(channel) = &mut write.scheduler_channel {
|
if let Some(channel) = &mut write.scheduler_channel {
|
||||||
channel
|
channel.unbounded_send(SchedulerMsg::DirtyAll).unwrap()
|
||||||
.unbounded_send(SchedulerMsg::Immediate(ScopeId(0)))
|
|
||||||
.unwrap()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue