Fix effect ordering after reruns

This commit is contained in:
Evan Almloff committed 2024-03-01 12:46:07 -06:00
1 parent 26f5fb80cb
commit a14e5be7ad
8 files changed
+89 -51

No files matched your search

+4 -4
View File
@@ -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;
}
});
});