Fix effects triggered from async tasks; improve work scheduling docs (#2370)
* outline work scheduling * move scheduling code from dirty_scope to scheduler * introduce queue_effect * Run effects after all tasks are polled if there are no components rerendered * add a new test for async effects
This commit is contained in:
1 parent
05eaca320f
commit
5290b658fd
11 files changed
+305
-53
No files matched your search
@@ -265,6 +265,11 @@ impl Scope {
|
||||
id
|
||||
}
|
||||
|
||||
/// Queue an effect to run after the next render
|
||||
pub fn queue_effect(&self, f: impl FnOnce() + 'static) {
|
||||
Runtime::with(|rt| rt.queue_effect(self.id, f)).expect("Runtime to exist");
|
||||
}
|
||||
|
||||
/// Mark this component as suspended on a specific task and then return None
|
||||
pub fn suspend(&self, task: Task) -> Option<Element> {
|
||||
self.last_suspendable_task.set(Some(task));
|
||||
|
||||
Reference in new issue
Block a user