Skip to content

Commit 27e3412

Browse files
committed
Merge branch 'main' into fredrik/fix-resolved-promise-hydration
2 parents 878f085 + ad517e5 commit 27e3412

276 files changed

Lines changed: 8916 additions & 2025 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/config.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,18 @@
10671067
"label": "infiniteQueryOptions",
10681068
"to": "framework/vue/reference/infiniteQueryOptions"
10691069
},
1070+
{
1071+
"label": "mutationOptions",
1072+
"to": "framework/vue/reference/mutationOptions"
1073+
},
1074+
{
1075+
"label": "usePrefetchQuery",
1076+
"to": "framework/vue/reference/usePrefetchQuery"
1077+
},
1078+
{
1079+
"label": "usePrefetchInfiniteQuery",
1080+
"to": "framework/vue/reference/usePrefetchInfiniteQuery"
1081+
},
10701082
{
10711083
"label": "hydration",
10721084
"to": "framework/vue/reference/hydration"
@@ -1112,6 +1124,10 @@
11121124
"label": "infiniteQueryOptions",
11131125
"to": "framework/solid/reference/infiniteQueryOptions"
11141126
},
1127+
{
1128+
"label": "mutationOptions",
1129+
"to": "framework/solid/reference/mutationOptions"
1130+
},
11151131
{
11161132
"label": "hydration",
11171133
"to": "framework/solid/reference/hydration"

docs/eslint/no-unstable-deps.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Examples of **incorrect** code for this rule:
2222

2323
```tsx
2424
/* eslint "@tanstack/query/no-unstable-deps": "warn" */
25-
import { useCallback } from 'React'
25+
import { useCallback } from 'react'
2626
import { useMutation } from '@tanstack/react-query'
2727

2828
function Component() {
@@ -38,7 +38,7 @@ Examples of **correct** code for this rule:
3838

3939
```tsx
4040
/* eslint "@tanstack/query/no-unstable-deps": "warn" */
41-
import { useCallback } from 'React'
41+
import { useCallback } from 'react'
4242
import { useMutation } from '@tanstack/react-query'
4343

4444
function Component() {

docs/framework/react/guides/advanced-ssr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ This ensures that only successfully resolved queries are persisted to storage, p
555555

556556
While we recommend the prefetching solution detailed above because it flattens request waterfalls both on the initial page load **and** any subsequent page navigation, there is an experimental way to skip prefetching altogether and still have streaming SSR work: `@tanstack/react-query-next-experimental`
557557

558-
This package will allow you to fetch data on the server (in a Client Component) by just calling `useSuspenseQuery` in your component. Results will then be streamed from the server to the client as SuspenseBoundaries resolve. If you call `useSuspenseQuery` without wrapping it in a `<Suspense>` boundary, the HTML response won't start until the fetch resolves. This can be when you want depending on the situation, but keep in mind that this will hurt your TTFB.
558+
This package will allow you to fetch data on the server (in a Client Component) by just calling `useSuspenseQuery` in your component. Results will then be streamed from the server to the client as SuspenseBoundaries resolve. If you call `useSuspenseQuery` without wrapping it in a `<Suspense>` boundary, the HTML response won't start until the fetch resolves. This can be what you want depending on the situation, but keep in mind that this will hurt your TTFB.
559559

560560
To achieve this, wrap your app in the `ReactQueryStreamedHydration` component:
561561

docs/framework/react/reference/useQuery.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ const {
8686
- If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number.
8787
- If set to a function, it will be called with `failureCount` (starting at `0` for the first retry) and `error` to determine if a retry should be attempted.
8888
- defaults to `3` on the client and `0` on the server
89-
- `retryOnMount: boolean`
90-
- If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`.
89+
- `retryOnMount: boolean | (query: Query) => boolean`
90+
- If set to `false`, the query will not be retried on mount if it contains an error and has no data. Defaults to `true`.
91+
- If set to a function, the function will be executed with the query to compute the value.
9192
- `retryDelay: number | (retryAttempt: number, error: TError) => number`
9293
- This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds.
9394
- A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff.

docs/framework/solid/reference/useQuery.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,9 @@ function App() {
277277
- If `true`, failed queries will retry infinitely.
278278
- If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number.
279279
- defaults to `3` on the client and `0` on the server
280-
- ##### `retryOnMount: boolean`
281-
- If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`.
280+
- ##### `retryOnMount: boolean | (query: Query) => boolean`
281+
- If set to `false`, the query will not be retried on mount if it contains an error and has no data. Defaults to `true`.
282+
- If set to a function, the function will be executed with the query to compute the value.
282283
- ##### `retryDelay: number | (retryAttempt: number, error: TError) => number`
283284
- This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds.
284285
- A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
id: mutationOptions
3+
title: mutationOptions
4+
ref: docs/framework/react/reference/mutationOptions.md
5+
---
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
id: usePrefetchInfiniteQuery
3+
title: usePrefetchInfiniteQuery
4+
ref: docs/framework/react/reference/usePrefetchInfiniteQuery.md
5+
replace: { '@tanstack/react-query': '@tanstack/vue-query' }
6+
---
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
id: usePrefetchQuery
3+
title: usePrefetchQuery
4+
ref: docs/framework/react/reference/usePrefetchQuery.md
5+
replace: { '@tanstack/react-query': '@tanstack/vue-query' }
6+
---

docs/reference/QueryClient.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ This distinction is more a "convenience" for ts devs that know which structure w
250250

251251
## `queryClient.setQueryData`
252252

253-
`setQueryData` is a synchronous function that can be used to immediately update a query's cached data. If the query does not exist, it will be created. **If the query is not utilized by a query hook in the default `gcTime` of 5 minutes, the query will be garbage collected**. To update multiple queries at once and match query keys partially, you need to use [`queryClient.setQueriesData`](#queryclientsetqueriesdata) instead.
253+
`setQueryData` is a synchronous function that can be used to immediately update a query's cached data. If the query does not exist, it will be created. **If the query is not utilized by a query hook within the default `gcTime`, the query will be garbage collected. If the default `gcTime` has not been configured, it defaults to 5 minutes.** To update multiple queries at once and match query keys partially, you need to use [`queryClient.setQueriesData`](#queryclientsetqueriesdata) instead.
254254

255255
> The difference between using `setQueryData` and `fetchQuery` is that `setQueryData` is sync and assumes that you already synchronously have the data available. If you need to fetch the data asynchronously, it's suggested that you either refetch the query key or use `fetchQuery` to handle the asynchronous fetch.
256256

eslint.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,14 @@ export default [
5252
plugins: { vitest },
5353
rules: {
5454
...vitest.configs.recommended.rules,
55+
'vitest/consistent-test-it': [
56+
'error',
57+
{ fn: 'it', withinDescribe: 'it' },
58+
],
5559
'vitest/no-standalone-expect': [
5660
'error',
5761
{
58-
additionalTestBlockFunctions: ['testIf'],
62+
additionalTestBlockFunctions: ['itIf'],
5963
},
6064
],
6165
},

0 commit comments

Comments
 (0)