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.
This commit is contained in:
1 parent
650605f4d1
commit
64106ba9af
1 file changed
+7
-7
@@ -191,6 +191,13 @@ impl SsrRendererPool {
|
|||||||
// poll the future, which may call server_context()
|
// poll the future, which may call server_context()
|
||||||
with_server_context(server_context.clone(), || virtual_dom.rebuild_in_place());
|
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();
|
let mut pre_body = String::new();
|
||||||
|
|
||||||
if let Err(err) = wrapper.render_head(&mut pre_body, &virtual_dom) {
|
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
|
// Render the initial frame with loading placeholders
|
||||||
let mut initial_frame = renderer.render(&virtual_dom);
|
let mut initial_frame = renderer.render(&virtual_dom);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user