Fix effect ordering after reruns
This commit is contained in:
1 parent
26f5fb80cb
commit
a14e5be7ad
8 files changed
+89
-51
No files matched your search
@@ -16,14 +16,14 @@ pub fn use_effect(mut callback: impl FnMut() + 'static) {
|
||||
spawn(async move {
|
||||
let rc = ReactiveContext::new_with_origin(location);
|
||||
loop {
|
||||
// Wait for the dom the be finished with sync work
|
||||
// flush_sync().await;
|
||||
|
||||
// Run the effect
|
||||
rc.run_in(&mut callback);
|
||||
|
||||
|
||||
// Wait for context to change
|
||||
rc.changed().await;
|
||||
|
||||
// Wait for the dom the be finished with sync work
|
||||
flush_sync().await;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user