Skip to content

Commit a7e6aca

Browse files
committed
Merge remote-tracking branch 'upstream/main' into feature/angular-stable
2 parents d1be49e + 747eea8 commit a7e6aca

File tree

188 files changed

+2808
-1940
lines changed

Some content is hidden

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

188 files changed

+2808
-1940
lines changed

docs/config.json

+8
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,10 @@
605605
"label": "QueriesObserver",
606606
"to": "reference/QueriesObserver"
607607
},
608+
{
609+
"label": "streamedQuery",
610+
"to": "reference/streamedQuery"
611+
},
608612
{
609613
"label": "focusManager",
610614
"to": "reference/focusManager"
@@ -957,6 +961,10 @@
957961
{
958962
"label": "Devtools Embedded Panel",
959963
"to": "framework/react/examples/devtools-panel"
964+
},
965+
{
966+
"label": "Chat example (streaming)",
967+
"to": "framework/react/examples/chat"
960968
}
961969
]
962970
},

docs/eslint/eslint-plugin-query.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ Alternatively, add `@tanstack/query` to the plugins section, and configure the r
9393

9494
## Rules
9595

96-
- [@tanstack/query/exhaustive-deps](./exhaustive-deps)
97-
- [@tanstack/query/no-rest-destructuring](./no-rest-destructuring)
98-
- [@tanstack/query/stable-query-client](./stable-query-client)
99-
- [@tanstack/query/no-unstable-deps](./no-unstable-deps)
100-
- [@tanstack/query/infinite-query-property-order](./infinite-query-property-order)
96+
- [@tanstack/query/exhaustive-deps](./exhaustive-deps.md)
97+
- [@tanstack/query/no-rest-destructuring](./no-rest-destructuring.md)
98+
- [@tanstack/query/stable-query-client](./stable-query-client.md)
99+
- [@tanstack/query/no-unstable-deps](./no-unstable-deps.md)
100+
- [@tanstack/query/infinite-query-property-order](./infinite-query-property-order.md)

docs/framework/react/community/community-projects.md

+6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ The Missing Fullstack Toolkit for Next.js
2525

2626
Link: https://blitzjs.com/
2727

28+
## Connect
29+
30+
A family of libraries for building building browser and gRPC-compatible HTTP APIs.
31+
32+
Link: https://connectrpc.com/docs
33+
2834
## GraphQL Code Generator
2935

3036
Generate React Query hooks from your GraphQL schema

docs/framework/react/community/tkdodos-blog.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ id: tkdodos-blog
33
title: TkDodo's Blog
44
---
55

6-
TanStack Query maintainer [TkDodo](https://twitter.com/tkdodo) has a series of blog posts about using and working with the library. Some articles show general best practices, but most have an _opinionated_ point of view.
6+
TanStack Query maintainer [TkDodo](https://bsky.app/profile/tkdodo.eu) has a series of blog posts about using and working with the library. Some articles show general best practices, but most have an _opinionated_ point of view.
77

88
## [#1: Practical React Query](https://tkdodo.eu/blog/practical-react-query)
99

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

+5-7
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@ title: Advanced Server Rendering
55

66
Welcome to the Advanced Server Rendering guide, where you will learn all about using React Query with streaming, Server Components and the Next.js app router.
77

8-
You might want to read the [Server Rendering & Hydration guide](./ssr) before this one as it teaches the basics for using React Query with SSR, and [Performance & Request Waterfalls](./request-waterfalls) as well as [Prefetching & Router Integration](./prefetching) also contains valuable background.
9-
10-
https://tanstack.com/query/latest/docs/framework/react/guides/ssr
8+
You might want to read the [Server Rendering & Hydration guide](./ssr.md) before this one as it teaches the basics for using React Query with SSR, and [Performance & Request Waterfalls](./request-waterfalls.md) as well as [Prefetching & Router Integration](./prefetching.md) also contains valuable background.
119

1210
Before we start, let's note that while the `initialData` approach outlined in the SSR guide also works with Server Components, we'll focus this guide on the hydration APIs.
1311

1412
## Server Components & Next.js app router
1513

1614
We won't cover Server Components in depth here, but the short version is that they are components that are guaranteed to _only_ run on the server, both for the initial page view and **also on page transitions**. This is similar to how Next.js `getServerSideProps`/`getStaticProps` and Remix `loader` works, as these also always run on the server but while those can only return data, Server Components can do a lot more. The data part is central to React Query however, so let's focus on that.
1715

18-
How do we take what we learned in the Server Rendering guide about [passing data prefetched in framework loaders to the app](./ssr#using-the-hydration-apis) and apply that to Server Components and the Next.js app router? The best way to start thinking about this is to consider Server Components as "just" another framework loader.
16+
How do we take what we learned in the Server Rendering guide about [passing data prefetched in framework loaders to the app](./ssr.md#using-the-hydration-apis) and apply that to Server Components and the Next.js app router? The best way to start thinking about this is to consider Server Components as "just" another framework loader.
1917

2018
### A quick note on terminology
2119

@@ -532,7 +530,7 @@ export default function Posts() {
532530

533531
Now, your `getPosts` function can return e.g. `Temporal` datetime objects and the data will be serialized and deserialized on the client, assuming your transformer can serialize and deserialize those data types.
534532

535-
For more information, check out the [Next.js App with Prefetching Example](../../examples/nextjs-app-prefetching).
533+
For more information, check out the [Next.js App with Prefetching Example](../examples/react/nextjs-app-prefetching).
536534

537535
## Experimental streaming without prefetching in Next.js
538536

@@ -599,11 +597,11 @@ export function Providers(props: { children: React.ReactNode }) {
599597
}
600598
```
601599

602-
For more information, check out the [NextJs Suspense Streaming Example](../../examples/nextjs-suspense-streaming).
600+
For more information, check out the [NextJs Suspense Streaming Example](../examples/react/nextjs-suspense-streaming).
603601

604602
The big upside is that you no longer need to prefetch queries manually to have SSR work, and it even still streams in the result! This gives you phenomenal DX and lower code complexity.
605603

606-
The downside is easiest to explain if we look back at [the complex request waterfall example](./request-waterfalls#code-splitting) in the Performance & Request Waterfalls guide. Server Components with prefetching effectively eliminates the request waterfalls both for the initial page load **and** any subsequent navigation. This prefetch-less approach however will only flatten the waterfalls on the initial page load but ends up the same deep waterfall as the original example on page navigations:
604+
The downside is easiest to explain if we look back at [the complex request waterfall example](./request-waterfalls.md#code-splitting) in the Performance & Request Waterfalls guide. Server Components with prefetching effectively eliminates the request waterfalls both for the initial page load **and** any subsequent navigation. This prefetch-less approach however will only flatten the waterfalls on the initial page load but ends up the same deep waterfall as the original example on page navigations:
607605

608606
```
609607
1. |> JS for <Feed>

docs/framework/react/guides/caching.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ id: caching
33
title: Caching Examples
44
---
55

6-
> Please thoroughly read the [Important Defaults](./important-defaults) before reading this guide
6+
> Please thoroughly read the [Important Defaults](./important-defaults.md) before reading this guide
77
88
## Basic Example
99

@@ -23,7 +23,7 @@ Let's assume we are using the default `gcTime` of **5 minutes** and the default
2323
- A second instance of `useQuery({ queryKey: ['todos'], queryFn: fetchTodos })` mounts elsewhere.
2424
- Since the cache already has data for the `['todos']` key from the first query, that data is immediately returned from the cache.
2525
- The new instance triggers a new network request using its query function.
26-
- Note that regardless of whether both `fetchTodos` query functions are identical or not, both queries' [`status`](../reference/useQuery) are updated (including `isFetching`, `isPending`, and other related values) because they have the same query key.
26+
- Note that regardless of whether both `fetchTodos` query functions are identical or not, both queries' [`status`](../reference/useQuery.md) are updated (including `isFetching`, `isPending`, and other related values) because they have the same query key.
2727
- When the request completes successfully, the cache's data under the `['todos']` key is updated with the new data, and both instances are updated with the new data.
2828
- Both instances of the `useQuery({ queryKey: ['todos'], queryFn: fetchTodos })` query are unmounted and no longer in use.
2929
- Since there are no more active instances of this query, a garbage collection timeout is set using `gcTime` to delete and garbage collect the query (defaults to **5 minutes**).

docs/framework/react/guides/dependent-queries.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,6 @@ const usersMessages = useQueries({
9090

9191
## A note about performance
9292

93-
Dependent queries by definition constitutes a form of [request waterfall](../../../react/guides/request-waterfalls), which hurts performance. If we pretend both queries take the same amount of time, doing them serially instead of in parallel always takes twice as much time, which is especially hurtful when it happens on a client that has high latency. If you can, it's always better to restructure the backend APIs so that both queries can be fetched in parallel, though that might not always be practically feasible.
93+
Dependent queries by definition constitutes a form of [request waterfall](./request-waterfalls.md), which hurts performance. If we pretend both queries take the same amount of time, doing them serially instead of in parallel always takes twice as much time, which is especially hurtful when it happens on a client that has high latency. If you can, it's always better to restructure the backend APIs so that both queries can be fetched in parallel, though that might not always be practically feasible.
9494

9595
In the example above, instead of first fetching `getUserByEmail` to be able to `getProjectsByUser`, introducing a new `getProjectsByUserEmail` query would flatten the waterfall.

docs/framework/react/guides/important-defaults.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Out of the box, TanStack Query is configured with **aggressive but sane** defaul
3636

3737
Have a look at the following articles from our Community Resources for further explanations of the defaults:
3838

39-
- [Practical React Query](../community/tkdodos-blog#1-practical-react-query)
40-
- [React Query as a State Manager](../community/tkdodos-blog#10-react-query-as-a-state-manager)
39+
- [Practical React Query](../community/tkdodos-blog.md#1-practical-react-query)
40+
- [React Query as a State Manager](../community/tkdodos-blog.md#10-react-query-as-a-state-manager)
4141

4242
[//]: # 'Materials'

docs/framework/react/guides/initial-query-data.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ There are many ways to supply initial data for a query to the cache before you n
88
- Declaratively:
99
- Provide `initialData` to a query to prepopulate its cache if empty
1010
- Imperatively:
11-
- [Prefetch the data using `queryClient.prefetchQuery`](../../../react/guides/prefetching)
12-
- [Manually place the data into the cache using `queryClient.setQueryData`](../../../react/guides/prefetching)
11+
- [Prefetch the data using `queryClient.prefetchQuery`](./prefetching.md)
12+
- [Manually place the data into the cache using `queryClient.setQueryData`](./prefetching.md)
1313

1414
## Using `initialData` to prepopulate a query
1515

@@ -170,6 +170,6 @@ const result = useQuery({
170170

171171
## Further reading
172172

173-
For a comparison between `Initial Data` and `Placeholder Data`, have a look at the [Community Resources](../community/tkdodos-blog#9-placeholder-and-initial-data-in-react-query).
173+
For a comparison between `Initial Data` and `Placeholder Data`, have a look at the [Community Resources](../community/tkdodos-blog.md#9-placeholder-and-initial-data-in-react-query).
174174

175175
[//]: # 'Materials'

docs/framework/react/guides/invalidations-from-mutations.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ const mutation = useMutation({
3636

3737
[//]: # 'Example2'
3838

39-
You can wire up your invalidations to happen using any of the callbacks available in the [`useMutation` hook](../mutations)
39+
You can wire up your invalidations to happen using any of the callbacks available in the [`useMutation` hook](./mutations.md)

docs/framework/react/guides/migrating-to-react-query-3.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ try {
103103

104104
Together, these provide the same experience as before, but with added control to choose which component trees you want to reset. For more information, see:
105105

106-
- [QueryErrorResetBoundary](../../reference/QueryErrorResetBoundary)
107-
- [useQueryErrorResetBoundary](../../reference/useQueryErrorResetBoundary)
106+
- [QueryErrorResetBoundary](../reference/QueryErrorResetBoundary.md)
107+
- [useQueryErrorResetBoundary](../reference/useQueryErrorResetBoundary.md)
108108

109109
### `QueryCache.getQuery()` has been replaced by `QueryCache.find()`.
110110

0 commit comments

Comments
 (0)