Include layout + content component deps in streaming page scan
The streaming page's component scan only covered the suspense placeholders, missing transitive deps from layout headers (e.g. ~cart-mini, ~auth-menu). Add layout.component_names to Layout class and include them plus page content_expr in the scan source. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -426,9 +426,15 @@ async def execute_page_streaming(
|
||||
content=SxExpr(suspense_content_sx),
|
||||
)
|
||||
|
||||
# Pass the SX source for component scanning (resolution scripts may
|
||||
# contain component calls that the client needs to render)
|
||||
page_sx_for_scan = f'(~app-body :header-rows {suspense_header_sx} :content {suspense_content_sx})'
|
||||
# Include layout component refs + page content so the scan picks up
|
||||
# their transitive deps (e.g. ~cart-mini, ~auth-menu in headers).
|
||||
layout_refs = ""
|
||||
if layout is not None and hasattr(layout, "component_names"):
|
||||
layout_refs = " ".join(f"({n})" for n in layout.component_names)
|
||||
content_ref = ""
|
||||
if page_def.content_expr is not None:
|
||||
content_ref = sx_serialize(page_def.content_expr)
|
||||
page_sx_for_scan = f'(<> {layout_refs} {content_ref} (~app-body :header-rows {suspense_header_sx} :content {suspense_content_sx}))'
|
||||
shell, tail = sx_page_streaming_parts(
|
||||
tctx, initial_page_html, page_sx=page_sx_for_scan,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user