From 0123c8094dda31b0a3c37daff9b118ed78996726 Mon Sep 17 00:00:00 2001 From: Gioele Vuaran Date: Tue, 2 Apr 2024 17:15:08 +0200 Subject: [PATCH] docs: `gcTime` max value (#7190) --- docs/framework/react/plugins/persistQueryClient.md | 2 ++ docs/framework/react/reference/useMutation.md | 1 + docs/framework/react/reference/useQuery.md | 1 + 3 files changed, 4 insertions(+) diff --git a/docs/framework/react/plugins/persistQueryClient.md b/docs/framework/react/plugins/persistQueryClient.md index 24e208a31f..90cf71288f 100644 --- a/docs/framework/react/plugins/persistQueryClient.md +++ b/docs/framework/react/plugins/persistQueryClient.md @@ -21,6 +21,8 @@ It should be set as the same value or higher than persistQueryClient's `maxAge` You can also pass it `Infinity` to disable garbage collection behavior entirely. +Due to a Javascript limitation, the maximum allowed `gcTime` is about 24 days (see [more](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#maximum_delay_value)). + ```tsx const queryClient = new QueryClient({ defaultOptions: { diff --git a/docs/framework/react/reference/useMutation.md b/docs/framework/react/reference/useMutation.md index 6929cbea2c..4e3ca04233 100644 --- a/docs/framework/react/reference/useMutation.md +++ b/docs/framework/react/reference/useMutation.md @@ -51,6 +51,7 @@ mutate(variables, { - `gcTime: number | Infinity` - The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. - If set to `Infinity`, will disable garbage collection + - Note: the maximum allowed time is about 24 days. See [more](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#maximum_delay_value). - `mutationKey: unknown[]` - Optional - A mutation key can be set to inherit defaults set with `queryClient.setMutationDefaults`. diff --git a/docs/framework/react/reference/useQuery.md b/docs/framework/react/reference/useQuery.md index f86e5c5911..73ff5b5132 100644 --- a/docs/framework/react/reference/useQuery.md +++ b/docs/framework/react/reference/useQuery.md @@ -96,6 +96,7 @@ const { - `gcTime: number | Infinity` - Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR - The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. + - Note: the maximum allowed time is about 24 days. See [more](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#maximum_delay_value). - If set to `Infinity`, will disable garbage collection - `queryKeyHashFn: (queryKey: QueryKey) => string` - Optional