diff --git a/packages/template/src/components/elements/ssr-layout-effect.tsx b/packages/template/src/components/elements/ssr-layout-effect.tsx index 90a7cf57a..a37713c16 100644 --- a/packages/template/src/components/elements/ssr-layout-effect.tsx +++ b/packages/template/src/components/elements/ssr-layout-effect.tsx @@ -1,6 +1,10 @@ "use client"; import { useLayoutEffect } from "react"; +function escapeHtmlAttr(str: string): string { + return str.replace(/&/g, '&').replace(/"/g, '"').replace(//g, '>'); +} + export function SsrScript(props: { script: string, nonce?: string }) { useLayoutEffect(() => { // TODO fix workaround: React has a bug where it doesn't run the script on the first CSR render if SSR has been skipped due to suspense @@ -9,11 +13,19 @@ export function SsrScript(props: { script: string, nonce?: string }) { (0, eval)(props.script); }, []); + // Embed the `, + }} /> ); }