01 · Before and afterThe pattern
// before: render-time write into a module-level store (shared by every SSR request)
useStore.getState().seed(id, loaderData);
// after: request-scoped value, store stays untouched on the server
const Initial = createContext<Bundle | null>(null);
<Initial.Provider value={loaderData ?? null}>{children}</Initial.Provider>;
// consumer: live store value wins, context is the fallback
const data = useStore((s) => s.bundles[id]) ?? use(Initial);02 · Run it on your appThe check
Does any server-rendered page write into a global client store (Zustand, Redux, a module variable) while rendering?
If the honest answer is no or not sure, this is worth a look before it reaches production.