re-rxjs / react-rxjs

React bindings for RxJS
https://react-rxjs.org
MIT License
542 stars 17 forks source link

NextJS 13 getServerSnapshot issue #305

Closed CMCDragonkai closed 11 months ago

CMCDragonkai commented 11 months ago

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: https://github.com/pmndrs/zustand/issues/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 11 months ago

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.

CMCDragonkai commented 11 months ago

Nice!

voliva commented 11 months ago

Fixed on 0.10.7