From c0ced8a40f37a4bc12fe7f7960f9f8182ae68f85 Mon Sep 17 00:00:00 2001 From: giles Date: Mon, 9 Mar 2026 00:17:01 +0000 Subject: [PATCH] Fix production blank page: SxExpr page_sx was being parsed as AST _build_component_ast parsed SxExpr values back into AST, which _arender then evaluated as HTML instead of passing through as raw content for the script tag. Dev mode was unaffected because the pretty-printer converted page_sx to a plain str first. Co-Authored-By: Claude Opus 4.6 --- shared/sx/helpers.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shared/sx/helpers.py b/shared/sx/helpers.py index 374b840..1fdccb9 100644 --- a/shared/sx/helpers.py +++ b/shared/sx/helpers.py @@ -811,6 +811,12 @@ async def sx_page(ctx: dict, page_sx: str, *, if pages_sx: _plog.debug("sx_page: pages_sx first 200 chars: %s", pages_sx[:200]) + # Ensure page_sx is a plain str, not SxExpr — _build_component_ast + # parses SxExpr back into AST, which _arender then evaluates as HTML + # instead of passing through as raw content for the script tag. + if isinstance(page_sx, SxExpr): + page_sx = "".join([page_sx]) + return await render_to_html( "sx-page-shell", title=_html_escape(title),