Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw-on-server-default-fix #7952

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

buddamus
Copy link

fix: stop defaulting to throwOnError=true when isServer===true so that SSR can render the page the same way the client will rather than showing the error boundary fallback

…t SSR can render the page the same way the client will rather than showing the error boundary fallback
…t SSR can render the page the same way the client will rather than showing the error boundary fallback
…t SSR can render the page the same way the client will rather than showing the error boundary fallback
@TkDodo
Copy link
Collaborator

TkDodo commented Aug 26, 2024

fix: stop defaulting to throwOnError=true when isServer===true so that SSR can render the page the same way the client will rather than showing the error boundary fallback

it's on purpose that we also throw errors on the server because what react will then do during SSR is render the Suspense fallback (not the error) and retry automatically on the client. The error boundary will only be shown once that fails, too.

@TkDodo TkDodo closed this Aug 26, 2024
@buddamus
Copy link
Author

@TkDodo My code change was not for react, but for solid (hence my changes are in packages/solid-query/src/createBaseQuery.ts).

What I am seeing is the server returns a page with the error boundary displayed. With the changes from this PR, the server sends exactly what I expected and still does the retry as you mentioned. I would prefer the server to not send with the error boundary and reserve the error boundary for unexpected errors. In my scenario, a fetch call is failing. I am manually handling this error with proper state management so it makes sense to me that the sever respects what my code is doing and serves the page just like the client would.

@TkDodo
Copy link
Collaborator

TkDodo commented Aug 26, 2024

right, maybe solid is different to react here. @ardeora FYI

@TkDodo TkDodo reopened this Aug 26, 2024
Copy link

nx-cloud bot commented Aug 26, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit cfe8a00. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


🟥 Failed Commands
nx affected --targets=test:sherif,test:knip,test:eslint,test:lib,test:types,test:build,build --parallel=3
✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

Copy link

pkg-pr-new bot commented Aug 26, 2024

commit: cfe8a00

@tanstack/angular-query-devtools-experimental

pnpm add https://pkg.pr.new/@tanstack/angular-query-devtools-experimental@7952

@tanstack/angular-query-experimental

pnpm add https://pkg.pr.new/@tanstack/angular-query-experimental@7952

@tanstack/eslint-plugin-query

pnpm add https://pkg.pr.new/@tanstack/eslint-plugin-query@7952

@tanstack/query-async-storage-persister

pnpm add https://pkg.pr.new/@tanstack/query-async-storage-persister@7952

@tanstack/query-broadcast-client-experimental

pnpm add https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@7952

@tanstack/query-core

pnpm add https://pkg.pr.new/@tanstack/query-core@7952

@tanstack/query-devtools

pnpm add https://pkg.pr.new/@tanstack/query-devtools@7952

@tanstack/query-persist-client-core

pnpm add https://pkg.pr.new/@tanstack/query-persist-client-core@7952

@tanstack/query-sync-storage-persister

pnpm add https://pkg.pr.new/@tanstack/query-sync-storage-persister@7952

@tanstack/react-query

pnpm add https://pkg.pr.new/@tanstack/react-query@7952

@tanstack/react-query-devtools

pnpm add https://pkg.pr.new/@tanstack/react-query-devtools@7952

@tanstack/react-query-next-experimental

pnpm add https://pkg.pr.new/@tanstack/react-query-next-experimental@7952

@tanstack/react-query-persist-client

pnpm add https://pkg.pr.new/@tanstack/react-query-persist-client@7952

@tanstack/solid-query

pnpm add https://pkg.pr.new/@tanstack/solid-query@7952

@tanstack/solid-query-devtools

pnpm add https://pkg.pr.new/@tanstack/solid-query-devtools@7952

@tanstack/solid-query-persist-client

pnpm add https://pkg.pr.new/@tanstack/solid-query-persist-client@7952

@tanstack/svelte-query

pnpm add https://pkg.pr.new/@tanstack/svelte-query@7952

@tanstack/svelte-query-devtools

pnpm add https://pkg.pr.new/@tanstack/svelte-query-devtools@7952

@tanstack/svelte-query-persist-client

pnpm add https://pkg.pr.new/@tanstack/svelte-query-persist-client@7952

@tanstack/vue-query

pnpm add https://pkg.pr.new/@tanstack/vue-query@7952

@tanstack/vue-query-devtools

pnpm add https://pkg.pr.new/@tanstack/vue-query-devtools@7952

Open in Stackblitz

More templates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants