RevereCRE/relay-nextjs

How to disable SSR?

punkpeye opened this issue · 2 comments

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?

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.

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