You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
useObservable: add getServerSnapshot to useSyncExternalStore for SSR #748
`useObservable` calls `useSyncExternalStore(subscribe, getSnapshot)` with only two arguments. React 18 requires a third `getServerSnapshot` for server rendering. Without it, React throws during SSR and Next.js App Router falls back to client rendering for any subtree using a reactfire hook.
The fix is to pass a `getServerSnapshot` that returns the same seeded `immutableStatus` the client snapshot returns. The server snapshot must be stable across server/client to avoid hydration mismatches, so `initialData` seeding is the natural tie-in.
Flagged in the arch review as a V5 "just do it" item: not a spike, not blocked on any API decision.
Surfaced during sandbox validation of #739. From the PR comment:
useObservable calls useSyncExternalStore(subscribe, getSnapshot) without a third getServerSnapshot argument. React 18 requires it for server rendering and throws when it's absent. During testing we observed Next.js catch this and fall back gracefully, so the app works, but we didn't characterize exactly what the server sends in that case. The arch review flagged this as a V5 "just do it" item.
Fix: pass getServerSnapshot returning the same seeded immutableStatus the client snapshot returns. Must be stable across server/client to avoid hydration mismatches — initialData seeding is the natural tie-in.
Activity
tyler-reitz commentedon Jul 21, 2026
Surfaced during sandbox validation of #739. From the PR comment:
Fix: pass
getServerSnapshotreturning the same seededimmutableStatusthe client snapshot returns. Must be stable across server/client to avoid hydration mismatches —initialDataseeding is the natural tie-in.fix(ssr): add getServerSnapshot to useObservable's useSyncExternalStore
fix(ssr): add getServerSnapshot to useObservable's useSyncExternalSto…