({ children }: { children: string })
| 5 | * Server-only helper to emit a script tag exactly once during SSR. |
| 6 | */ |
| 7 | export function ScriptOnce({ children }: { children: string }) { |
| 8 | const router = useRouter() |
| 9 | if (!(isServer ?? router.isServer)) { |
| 10 | return null |
| 11 | } |
| 12 | |
| 13 | return ( |
| 14 | <script |
| 15 | nonce={router.options.ssr?.nonce} |
| 16 | dangerouslySetInnerHTML={{ |
| 17 | __html: children + ';document.currentScript.remove()', |
| 18 | }} |
| 19 | /> |
| 20 | ) |
| 21 | } |
nothing calls this directly
no test coverage detected