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,5 +1,5 @@
|
||||
use crate::{runtime::Runtime, Element, ScopeId, Task};
|
||||
use futures_util::{future::poll_fn, Future};
|
||||
use futures_util::Future;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Get the current scope id
|
||||
@@ -257,13 +257,11 @@ pub fn after_render(f: impl FnMut() + 'static) {
|
||||
/// Effects rely on this to ensure that they only run effects after the DOM has been updated. Without flush_sync effects
|
||||
/// are run immediately before diffing the DOM, which causes all sorts of out-of-sync weirdness.
|
||||
pub async fn flush_sync() {
|
||||
// if flushing() {
|
||||
// return;
|
||||
// }
|
||||
|
||||
_ = Runtime::with(|rt| rt.flush.clone())
|
||||
// Wait for the flush lock to be available
|
||||
// We release it immediately, so it's impossible for the lock to be held longer than this function
|
||||
Runtime::with(|rt| rt.flush_mutex.clone())
|
||||
.unwrap()
|
||||
.recv_async()
|
||||
.lock()
|
||||
.await;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user