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

Function Scripts

packages/solid-router/src/Scripts.tsx:16–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14 * begin to be inserted.
15 */
16export const Scripts = () => {
17 const router = useRouter()
18 const nonce = router.options.ssr?.nonce
19
20 const scripts = Solid.createMemo(
21 (previous: Array<RouterManagedTag> | undefined) => {
22 const next = composeSsrBodyScripts(
23 getSsrBodyScriptParts(
24 router.stores.matches.get(),
25 router.ssr?.manifest,
26 nonce,
27 ),
28 )
29 return previous ? replaceEqualDeep(previous, next) : next
30 },
31 )
32 const initialHydrationScripts =
33 (isServer ?? router.isServer) && router.serverSsr
34 ? router.serverSsr.takeInitialHydrationScriptTags()
35 : undefined
36 const tags = () =>
37 initialHydrationScripts
38 ? composeSsrBodyScripts([scripts(), []], initialHydrationScripts)
39 : scripts()
40 return (
41 <>
42 <Solid.For each={tags()}>{(asset) => <Asset {...asset} />}</Solid.For>
43 </>
44 )
45}

Callers

nothing calls this directly

Calls 7

useRouterFunction · 0.90
composeSsrBodyScriptsFunction · 0.90
getSsrBodyScriptPartsFunction · 0.90
replaceEqualDeepFunction · 0.90
tagsFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected