FormidableLabs / urql-exchange-suspense

An exchange for client-side React Suspense support in urql
43 stars 1 forks source link

Working example of urql + suspenseExchange + SSR (Next.js) #5

Open jgoux opened 4 years ago

jgoux commented 4 years ago

Hello,

I tried to follow the steps to setup suspenseExchange along with SSR :

const isClient = !!process.browser;

const client = createClient({
  url: 'http://localhost:1234/graphql',
  suspense: true,
  exchanges: [
    dedupExchange,
    isClient && suspenseExchange,
    ssrExchange({
      initialData: isClient ? window.URQL_DATA : undefined,
      // This will need to be passed explicitly to ssrExchange:
      isClient: !!isClient
    })
    cacheExchange,
    fetchExchange,
  ].filter(Boolean),
});

It seems like initialData is now initialState? Even by changing it I'm still not sure about what to do next.

Would it be possible to setup a minimal example with all these features?