RevereCRE/relay-nextjs

How set headers from server request?

stug111 opened this issue · 1 comments

Hello, tell me how to set the headers received from the server on the client?

In apollo, this is done via setContext is there anything good here.

I am trying to implement adding to cart for unauthorized users. For this to work, I need to always update the user session, since it comes from the server.

I also noticed that when the page is redirected, usePreloadedQuery is triggered twice, is this normal?

It is also interesting how to implement work with the jwt token, in particular, tracking the error and performing a re-request.

Hi! relay-nextjs doesn't send GraphQL requests for you or really have much of an opinion about how network requests are sent. It relies on the Relay Network Layer to handle all of that, which must be provided when creating an Environment.

usePreloadedQuery is intended to be called twice when rendering on the client-side because that's how the page suspends 🙂