Skip to content
Discussion options

You must be logged in to vote

Adding { deferStream: true } is the answer.

In your code example, session.data.id is always undefined because session.data is you object you passeduseSession, so it always runs the redirect.

Without deferStream, when you visit the link directly, you have two responses from the server. The initial streamed html, and then data later in a second response. The redirect is done via a 302 Redirect using headers, but headers are already set in the initial response, hence the error message.

With deferStream, the server waits until the query finishes before sending anything. No double headers.

When you navigate using page links, there is client side navigation and no streaming. Only the data needs…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Kisagi07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants