rename flush_sync to wait_for_next_render

This commit is contained in:
Evan Almloff committed 2024-03-04 19:52:17 -06:00
1 parent 2e3a730ed5
commit 287416cfa7
7 files changed
+17 -24

No files matched your search

+3 -3
View File
@@ -250,14 +250,14 @@ pub fn after_render(f: impl FnMut() + 'static) {
Runtime::with_current_scope(|cx| cx.push_after_render(f));
}
/// Wait for the virtualdom to finish its sync work before proceeding
/// Wait for the next render to complete
///
/// This is useful if you've just triggered an update and want to wait for it to finish before proceeding with valid
/// DOM nodes.
///
/// Effects rely on this to ensure that they only run effects after the DOM has been updated. Without flush_sync effects
/// Effects rely on this to ensure that they only run effects after the DOM has been updated. Without wait_for_next_render effects
/// are run immediately before diffing the DOM, which causes all sorts of out-of-sync weirdness.
pub async fn flush_sync() {
pub async fn wait_for_next_render() {
// 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.render_signal.subscribe())