re-rxjs/react-rxjs

NextJS 13 getServerSnapshot issue

Closed this issue · 3 comments

When using react-rxjs inside a nextjs client component, I see this on the server sometimes:

- error Error: Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering.

There's a similar issue on zustand: pmndrs/zustand#886.

I only saw this error when I started using react-rxjs, seems to apply to state/hook related libraries? I'm not entirely sure why it would occur when I start using react-rxjs.

voliva commented

Hey, thank you for raising this issue. Currently looking for some options.

I only saw this error when I started using react-rxjs, seems to apply to state/hook related libraries? I'm not entirely sure why it would occur when I start using react-rxjs.

Yes, useStateObservable (or the hook returned by bind) uses React's useSyncExternalStore, and this one emits this warning when it's not set up for SSR.

Nice!

voliva commented

Fixed on 0.10.7