Server: Phase 2 (REVIEW not respected yet)

This commit is contained in:
Thomas Karner committed 2026-09-21 11:24:43 +02:00
1 parent 5d16ded553
commit 142b47674d
4271 files changed
+1203269

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
import { useRouter } from "./useRouter.js";
import { isServer } from "@tanstack/router-core/isServer";
import { jsx } from "react/jsx-runtime";
//#region src/ScriptOnce.tsx
/**
* Server-only helper to emit a script tag exactly once during SSR.
*/
function ScriptOnce({ children }) {
const router = useRouter();
if (!(isServer ?? router.isServer)) return null;
return /* @__PURE__ */ jsx("script", {
nonce: router.options.ssr?.nonce,
dangerouslySetInnerHTML: { __html: children + ";document.currentScript.remove()" }
});
}
//#endregion
export { ScriptOnce };
//# sourceMappingURL=ScriptOnce.js.map