Every page is now built as HTML from sitePages.ts, with a catch-all route for 404.html. Hooks that read the browser during render are safe for prerendering. The script step that keeps the CSP intact follows, so this build still has inline scripts and is not deployable yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
15 lines
430 B
TypeScript
15 lines
430 B
TypeScript
import { useSyncExternalStore } from 'react';
|
|
|
|
const subscribeNoop = () => () => {};
|
|
|
|
// False while prerendering and during the hydrating render, true afterwards
|
|
// (and at once for components that mount later). Same behaviour as the
|
|
// useHydrated that the router keeps internally.
|
|
export default function useHydrated() {
|
|
return useSyncExternalStore(
|
|
subscribeNoop,
|
|
() => true,
|
|
() => false,
|
|
);
|
|
}
|