Use futures_util mutex instead of flume for sending flush lock wakeups

This commit is contained in:
Jonathan Kelley committed 2024-02-02 13:09:26 -08:00
1 parent 38bdab880d
commit 8f70a84c70
14 files changed
+100 -43

No files matched your search

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