From 5b0c2697458f30426f59c38302d06529a84d6b58 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 24 Jan 2025 11:32:41 -0600 Subject: [PATCH 1/2] better document `throwOnError`'s default --- docs/framework/react/reference/useMutation.md | 2 +- docs/framework/react/reference/useQuery.md | 2 +- docs/framework/solid/reference/createQuery.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/framework/react/reference/useMutation.md b/docs/framework/react/reference/useMutation.md index dc97396d01..b3f68a35b0 100644 --- a/docs/framework/react/reference/useMutation.md +++ b/docs/framework/react/reference/useMutation.md @@ -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`. - Set this to `true` if you want mutation errors to be thrown in the render phase and propagate to the nearest error boundary - Set this to `false` to disable the behavior of throwing errors to the error boundary. - If set to a function, it will be passed the error and should return a boolean indicating whether to show the error in an error boundary (`true`) or return the error as state (`false`) diff --git a/docs/framework/react/reference/useQuery.md b/docs/framework/react/reference/useQuery.md index 3032287d90..40b6938bab 100644 --- a/docs/framework/react/reference/useQuery.md +++ b/docs/framework/react/reference/useQuery.md @@ -167,7 +167,7 @@ const { - Defaults to `true` - If set to `false`, this instance of `useQuery` will not be subscribed to the cache. This means it won't trigger the `queryFn` on its own, and it won't receive updates if data gets into cache by other means. - `throwOnError: undefined | boolean | (error: TError, query: Query) => boolean` - - Defaults to the global query config's `throwOnError` value, which is `undefined` + - Defaults to the global `QueryClient`'s `defaultOptions.queries.throwOnError`. - Set this to `true` if you want errors to be thrown in the render phase and propagate to the nearest error boundary - Set this to `false` to disable `suspense`'s default behavior of throwing errors to the error boundary. - If set to a function, it will be passed the error and the query, and it should return a boolean indicating whether to show the error in an error boundary (`true`) or return the error as state (`false`) diff --git a/docs/framework/solid/reference/createQuery.md b/docs/framework/solid/reference/createQuery.md index 9553a30ae6..9231e3fb54 100644 --- a/docs/framework/solid/reference/createQuery.md +++ b/docs/framework/solid/reference/createQuery.md @@ -290,7 +290,7 @@ function App() { - The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. - If set to `Infinity`, the data will never be considered stale - ##### `throwOnError: undefined | boolean | (error: TError, query: Query) => boolean` - - Defaults to the global query config's `throwOnError` value, which is `undefined` + - Defaults to the global `QueryClient`'s `defaultOptions.queries.throwOnError`. - Set this to `true` if you want errors to be thrown in the render phase and propagate to the nearest error boundary - Set this to `false` to disable `suspense`'s default behavior of throwing errors to the error boundary. - If set to a function, it will be passed the error and the query, and it should return a boolean indicating whether to show the error in an error boundary (`true`) or return the error as state (`false`) From d71e24db39f30b58f8b68a264d87d91acf519f35 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 10 Feb 2025 10:38:50 -0600 Subject: [PATCH 2/2] delete unnecessary defaultOptions doc --- docs/framework/react/reference/useMutation.md | 1 - docs/framework/react/reference/useQuery.md | 1 - docs/framework/solid/reference/createQuery.md | 1 - 3 files changed, 3 deletions(-) diff --git a/docs/framework/react/reference/useMutation.md b/docs/framework/react/reference/useMutation.md index b3f68a35b0..4175555a53 100644 --- a/docs/framework/react/reference/useMutation.md +++ b/docs/framework/react/reference/useMutation.md @@ -94,7 +94,6 @@ 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 `QueryClient`'s `defaultOptions.queries.throwOnError`. - Set this to `true` if you want mutation errors to be thrown in the render phase and propagate to the nearest error boundary - Set this to `false` to disable the behavior of throwing errors to the error boundary. - If set to a function, it will be passed the error and should return a boolean indicating whether to show the error in an error boundary (`true`) or return the error as state (`false`) diff --git a/docs/framework/react/reference/useQuery.md b/docs/framework/react/reference/useQuery.md index 40b6938bab..2f6f9255c4 100644 --- a/docs/framework/react/reference/useQuery.md +++ b/docs/framework/react/reference/useQuery.md @@ -167,7 +167,6 @@ const { - Defaults to `true` - If set to `false`, this instance of `useQuery` will not be subscribed to the cache. This means it won't trigger the `queryFn` on its own, and it won't receive updates if data gets into cache by other means. - `throwOnError: undefined | boolean | (error: TError, query: Query) => boolean` - - Defaults to the global `QueryClient`'s `defaultOptions.queries.throwOnError`. - Set this to `true` if you want errors to be thrown in the render phase and propagate to the nearest error boundary - Set this to `false` to disable `suspense`'s default behavior of throwing errors to the error boundary. - If set to a function, it will be passed the error and the query, and it should return a boolean indicating whether to show the error in an error boundary (`true`) or return the error as state (`false`) diff --git a/docs/framework/solid/reference/createQuery.md b/docs/framework/solid/reference/createQuery.md index 9231e3fb54..247d150ae9 100644 --- a/docs/framework/solid/reference/createQuery.md +++ b/docs/framework/solid/reference/createQuery.md @@ -290,7 +290,6 @@ function App() { - The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. - If set to `Infinity`, the data will never be considered stale - ##### `throwOnError: undefined | boolean | (error: TError, query: Query) => boolean` - - Defaults to the global `QueryClient`'s `defaultOptions.queries.throwOnError`. - Set this to `true` if you want errors to be thrown in the render phase and propagate to the nearest error boundary - Set this to `false` to disable `suspense`'s default behavior of throwing errors to the error boundary. - If set to a function, it will be passed the error and the query, and it should return a boolean indicating whether to show the error in an error boundary (`true`) or return the error as state (`false`)