T
TanStack16h ago
provincial-silver

Streaming with server components

Context: - I am using the queryClient.prefetchQuery() method from the advanced-ssr.md guide explained here. - I don't await the prefetch - I use the shouldDehydrateQuery: (query) => defaultShouldDehydrateQuery(query) ||.state.status === 'pending' setup, so streaming is "enabled". - I use useSuspenseQuery inside my component Everything is working as expected, when we have successful responses from our API. When we have 400, 404 or 500 status code responses, the pending query fails and I get the following the following two error message: - A query that was dehydrated as pending ended up rejecting -> This error message is shown, because I am redacting the error messages. - Switched to client rendering because the server rendering errored. My questions are: 1. This is probably expected behaviour when using streaming, right ? 2. The switching to client rendering should not cause any issues ? 3. Is this approach and behaviour something you would recommend for apps, or should we rather avoid streaming ? Thank you for the help, much appreciated!
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?