Use futures_util mutex instead of flume for sending flush lock wakeups
This commit is contained in:
14 files changed
+100
-43
No files matched your search
@@ -1,7 +1,5 @@
|
||||
use crate::use_hook_did_run;
|
||||
use dioxus_core::prelude::*;
|
||||
use dioxus_signals::{CopyValue, Effect, ReactiveContext, Writable};
|
||||
// use futures_util::select;
|
||||
use dioxus_signals::ReactiveContext;
|
||||
|
||||
/// Create a new effect. The effect will be run immediately and whenever any signal it reads changes.
|
||||
/// The signal will be owned by the current component and will be dropped when the component is dropped.
|
||||
@@ -16,6 +14,9 @@ pub fn use_effect(mut callback: impl FnMut() + 'static) {
|
||||
let rc = ReactiveContext::new(None);
|
||||
|
||||
loop {
|
||||
// Wait for the dom the be finished with sync work
|
||||
flush_sync().await;
|
||||
|
||||
// Run the effect
|
||||
rc.run_in(|| callback());
|
||||
|
||||
|
||||
Reference in new issue
Block a user