mirror of
https://github.com/supabase/supabase.git
synced 2026-10-10 20:05:06 +03:00
Two changes that together remove BAILOUT_TO_CLIENT_SIDE_RENDERING from
the rendered HTML so crawlers and LLM bots see the actual pricing
content (FE-3079).
1. useThemeSandbox: hoist `useState` and `useEffect` above the
environment check. The previous `if (typeof window === 'undefined' ||
IS_PROD) return null` ran before any hooks, so on preview deploys
(IS_PROD=false) the server returned null with 0 hooks while the
client called 2 hooks — a Rules of Hooks violation that React
converts into a CSR bailout. Hooks now run unconditionally; all side
effects are gated inside the effect, which never runs during SSR.
2. providers.tsx: wrap each side-effect-y sibling
(TelemetryTagManager, Toaster, WwwCommandMenu, PageTelemetry,
DevToolbar) in its own <Suspense> boundary. If any of them does
trigger a bailout (e.g. a transitive dependency reading
useSearchParams without a Suspense boundary), it's contained to that
subtree instead of propagating up past `{children}` and hiding the
page from the SSR'd HTML.