RevereCRE / relay-nextjs

⚡️ Relay integration for Next.js apps
https://reverecre.github.io/relay-nextjs/
MIT License
251 stars 30 forks source link

How to disable SSR? #75

Closed punkpeye closed 1 year ago

punkpeye commented 1 year ago

It is really hard to debug when something goes wrong server-side.

How do I force relay-nextjs to serve static JavaScript and make GraphQL queries client-side?

rrdelaney commented 1 year ago

Next.js makes it quite difficult to entirely disable SSR, and relay-nextjs's data fetching is tightly integrated with the lifecycle of Next.js pages. Suggested workarounds are:

  1. Start the session on a page separate from the one being debugged (a simple static page will work), then navigate to the target page. relay-nextjs does not use SSR or getServerSideProps on subsequent page navigations.
  2. Use lazyLoadQuery to fetch page data rather than withRelay. This will skip over pretty much all of relay-nextjs's internal workings so debugging how this library works would be difficult.

Let me know if either of these work for you, we'd be happy to add them to an FAQ on the documentation site.

punkpeye commented 1 year ago

Use lazyLoadQuery to fetch page data rather than withRelay. This will skip over pretty much all of relay-nextjs's internal workings so debugging how this library works would be difficult.

I will try this path.

Thank you