-
Hey! Love the library, thanks for all the work you have put into it! Overview(I'm not sure if this feature already exists, so posting as a Q&A) We have a use case where we query some content on the server and based on that query we render either the content of the page or a 404 page. Currently, I haven't found a way to set a query to an error state for the server side render of the application (using react in this case). The server sends a query and we This would allow rendering the application in the "error" state on the server. Currently the application is always rendered in the "pending" state if no query data is available. SandboxHere's an sandbox that demos this, but fails to render the app in the "error" state on the SSR. Reloading on the "error" page should initially render in the "error" state instead of the "pending" state. https://stackblitz.com/edit/stackblitz-starters-rjijfw?file=src%2Fpages%2F%5Bid%5D.js QuestionIs there a "blessed" way to instantiate a query in the "error" state initially? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
errors per se aren't serializable over the wire, that's we we don't dehydrate them. If you want that, you'd need to plug something like superjson into it: https://tanstack.com/query/latest/docs/framework/react/reference/hydration#limitations |
Beta Was this translation helpful? Give feedback.
errors per se aren't serializable over the wire, that's we we don't dehydrate them. If you want that, you'd need to plug something like superjson into it:
https://tanstack.com/query/latest/docs/framework/react/reference/hydration#limitations