MCPcopy Create free account
hub / github.com/TanStack/router / ScriptOnce

Function ScriptOnce

packages/solid-router/src/ScriptOnce.tsx:4–22  ·  view source on GitHub ↗
({
  children,
}: {
  children: string
  log?: boolean
  sync?: boolean
})

Source from the content-addressed store, hash-verified

2import { useRouter } from './useRouter'
3
4export function ScriptOnce({
5 children,
6}: {
7 children: string
8 log?: boolean
9 sync?: boolean
10}) {
11 const router = useRouter()
12 if (!(isServer ?? router.isServer)) {
13 return null
14 }
15 return (
16 <script
17 nonce={router.options.ssr?.nonce}
18 class="$tsr"
19 innerHTML={children + ';document.currentScript.remove()'}
20 />
21 )
22}

Callers

nothing calls this directly

Calls 1

useRouterFunction · 0.90

Tested by

no test coverage detected