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

better document throwOnError's default #8581

Merged
merged 3 commits into from
Feb 16, 2025

Conversation

AlexErrant
Copy link
Contributor

As a new user, I had no idea what "global query config" meant, and searching for "config" wasn't helpful. This PR updates the wording.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jan 24, 2025
Copy link

nx-cloud bot commented Jan 24, 2025

View your CI Pipeline Execution ↗ for commit d71e24d.

Command Status Duration Result
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2025-02-10 16:39:48 UTC

Copy link

nx-cloud bot commented Jan 24, 2025

View your CI Pipeline Execution ↗ for commit 5b0c269.


☁️ Nx Cloud last updated this comment at 2025-01-24 17:38:56 UTC

@@ -94,7 +94,7 @@ mutate(variables, {
- Defaults to a unique id (so that all mutations run in parallel)
- Mutations with the same scope id will run in serial
- `throwOnError: undefined | boolean | (error: TError) => boolean`
- Defaults to the global query config's `throwOnError` value, which is `undefined`
- Defaults to the global `QueryClient`'s `defaultOptions.queries.throwOnError`.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this true for mutations? Ref: #8569

Copy link

pkg-pr-new bot commented Jan 24, 2025

Open in Stackblitz

More templates

@tanstack/angular-query-devtools-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-devtools-experimental@8581

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@8581

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@8581

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@8581

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@8581

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@8581

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@8581

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@8581

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@8581

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@8581

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@8581

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@8581

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@8581

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@8581

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@8581

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@8581

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@8581

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@8581

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@8581

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@8581

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@8581

commit: d71e24d

@emilwall
Copy link

The throwOnError part might be a residue from before #1130? I am really new to this library so please don't take my word for it.

Copy link
Collaborator

@TkDodo TkDodo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defaults to the global QueryClient's defaultOptions.queries.throwOnError.

I would rather just remove that sentence. All config options can be defined as default on the queryClient, or they can be set with queryClient.setDefaultOptions for a specific key, too.

This mechanism should not be documented in the reference docs, because we would need to state that for all options.

@TkDodo TkDodo merged commit bb25d06 into TanStack:main Feb 16, 2025
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants