use queue_events instead of process_events to fix ssr issue (#4772)

* use `queue_events` instead of `process_events` to fix ssr issue

* remove suspense wait from liveview
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2025-10-11 21:03:54 -07:00
1 parent 01db142750
commit 76319005b8
3 files changed
+3 -11

No files matched your search

+2
View File
@@ -640,6 +640,8 @@ impl VirtualDom {
#[instrument(skip(self), level = "trace", name = "VirtualDom::wait_for_suspense")]
pub async fn wait_for_suspense(&mut self) {
loop {
self.queue_events();
if !self.suspended_tasks_remaining() && !self.has_dirty_scopes() {
break;
}
-4
View File
@@ -208,10 +208,6 @@ impl SsrRendererPool {
// rebuild the virtual dom
virtual_dom.rebuild_in_place();
// Process any pending events that might have been triggered during the rebuild
// This ensures things like error boundaries get a chance to run.
virtual_dom.process_events();
// If streaming is disabled, wait for the virtual dom to finish all suspense work
// before rendering anything
if streaming_mode == StreamingMode::Disabled {
+1 -7
View File
@@ -11,7 +11,7 @@ use dioxus_html::{EventData, HtmlEvent, PlatformEventData};
use dioxus_interpreter_js::MutationState;
use futures_util::{pin_mut, SinkExt, StreamExt};
use serde::Serialize;
use std::{any::Any, rc::Rc, time::Duration};
use std::{any::Any, rc::Rc};
use tokio_util::task::LocalPoolHandle;
#[derive(Clone)]
@@ -238,12 +238,6 @@ pub async fn run(mut vdom: VirtualDom, ws: impl LiveViewSocket) -> Result<(), Li
}
}
// wait for suspense to resolve in a 10ms window
tokio::select! {
_ = tokio::time::sleep(Duration::from_millis(10)) => {}
_ = vdom.wait_for_suspense() => {}
}
// render the vdom
vdom.render_immediate(&mut mutations);