Explorar o código

fix(fullstack): correct suspense handling in SSR renderer (#3829)

Move suspense handling to the correct position in the SSR renderer to ensure proper rendering when streaming is disabled.
hackartist hai 3 meses
pai
achega
64106ba9af
Modificáronse 1 ficheiros con 7 adicións e 7 borrados
  1. 7 7
      packages/fullstack/src/render.rs

+ 7 - 7
packages/fullstack/src/render.rs

@@ -191,6 +191,13 @@ impl SsrRendererPool {
             // poll the future, which may call server_context()
             with_server_context(server_context.clone(), || virtual_dom.rebuild_in_place());
 
+            // If streaming is disabled, wait for the virtual dom to finish all suspense work
+            // before rendering anything
+            if streaming_mode == StreamingMode::Disabled {
+                ProvideServerContext::new(virtual_dom.wait_for_suspense(), server_context.clone())
+                    .await
+            }
+
             let mut pre_body = String::new();
 
             if let Err(err) = wrapper.render_head(&mut pre_body, &virtual_dom) {
@@ -218,13 +225,6 @@ impl SsrRendererPool {
                 };
             }
 
-            // If streaming is disabled, wait for the virtual dom to finish all suspense work
-            // before rendering anything
-            if streaming_mode == StreamingMode::Disabled {
-                ProvideServerContext::new(virtual_dom.wait_for_suspense(), server_context.clone())
-                    .await
-            }
-
             // Render the initial frame with loading placeholders
             let mut initial_frame = renderer.render(&virtual_dom);