Skip to content

Commit

Permalink
Merge branch 'main' into docs/query-core-tsdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
TkDodo committed May 10, 2024
2 parents f92d40d + 2a3111b commit e2bc5cb
Show file tree
Hide file tree
Showing 73 changed files with 232 additions and 220 deletions.
2 changes: 2 additions & 0 deletions docs/framework/react/guides/query-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,6 @@ Additionally, [Infinite Queries](../infinite-queries) get the following options
- `pageParam: TPageParam`
- the page parameter used to fetch the current page
- `direction: 'forward' | 'backward'`
- **deprecated**
- the direction of the current page fetch
- To get access to the direction of the current page fetch, please add a direction to `pageParam` from `getNextPageParam` and `getPreviousPageParam`.
2 changes: 1 addition & 1 deletion docs/framework/react/guides/ssr.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ dehydrate(queryClient, {

When doing `return { props: { dehydratedState: dehydrate(queryClient) } }` in Next.js, or `return json({ dehydratedState: dehydrate(queryClient) })` in Remix, what happens is that the `dehydratedState` representation of the `queryClient` is serialized by the framework so it can be embedded into the markup and transported to the client.

By default, these frameworks only supports returning things that are safely serializable/parsable, and therefor does not support `undefined`, `Error`, `Date`, `Map`, `Set`, `BigInt`, `Infinity`, `NaN`, `-0`, regular expressions etc. This also means that you can not return any of these things from your queries. If returning these values is something you want, check out [superjson](https://github.com/blitz-js/superjson) or similar packages.
By default, these frameworks only supports returning things that are safely serializable/parsable, and therefore does not support `undefined`, `Error`, `Date`, `Map`, `Set`, `BigInt`, `Infinity`, `NaN`, `-0`, regular expressions etc. This also means that you can not return any of these things from your queries. If returning these values is something you want, check out [superjson](https://github.com/blitz-js/superjson) or similar packages.

If you are using a custom SSR setup, you need to take care of this step yourself. Your first instinct might be to use `JSON.stringify(dehydratedState)`, but because this doesn't escape things like `<script>alert('Oh no..')</script>` by default, this can easily lead to **XSS-vulnerabilities** in your application. [superjson](https://github.com/blitz-js/superjson) also **does not** escape values and is unsafe to use by itself in a custom SSR setup (unless you add an extra step for escaping the output). Instead we recommend using a library like [Serialize JavaScript](https://github.com/yahoo/serialize-javascript) or [devalue](https://github.com/Rich-Harris/devalue) which are both safe against XSS injections out of the box.

Expand Down
7 changes: 5 additions & 2 deletions docs/framework/react/guides/window-focus-refetching.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ In rare circumstances, you may want to manage your own window focus events that
focusManager.setEventListener((handleFocus) => {
// Listen to visibilitychange
if (typeof window !== 'undefined' && window.addEventListener) {
window.addEventListener('visibilitychange', () => handleFocus(), false)
const visibilitychangeHandler = () => {
handleFocus(document.visibilityState === 'visible')
}
window.addEventListener('visibilitychange', visibilitychangeHandler, false)
return () => {
// Be sure to unsubscribe if a new handler is set
window.removeEventListener('visibilitychange', () => handleFocus())
window.removeEventListener('visibilitychange', visibilitychangeHandler)
}
}
})
Expand Down
4 changes: 2 additions & 2 deletions examples/angular/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@angular/platform-browser": "^17.3.3",
"@angular/platform-browser-dynamic": "^17.3.3",
"@angular/router": "^17.3.3",
"@tanstack/angular-query-experimental": "^5.35.3",
"@tanstack/angular-query-experimental": "^5.35.4",
"rxjs": "^7.8.1",
"tslib": "^2.6.2",
"zone.js": "^0.14.4"
Expand All @@ -26,7 +26,7 @@
"@angular-devkit/build-angular": "^17.3.3",
"@angular/cli": "^17.3.3",
"@angular/compiler-cli": "^17.3.3",
"@tanstack/angular-query-devtools-experimental": "^5.35.3",
"@tanstack/angular-query-devtools-experimental": "^5.35.4",
"typescript": "5.2.2"
}
}
4 changes: 2 additions & 2 deletions examples/angular/infinite-query-with-max-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@angular/platform-browser": "^17.3.3",
"@angular/platform-browser-dynamic": "^17.3.3",
"@angular/router": "^17.3.3",
"@tanstack/angular-query-experimental": "^5.35.3",
"@tanstack/angular-query-experimental": "^5.35.4",
"rxjs": "^7.8.1",
"tslib": "^2.6.2",
"zone.js": "^0.14.4"
Expand All @@ -26,7 +26,7 @@
"@angular-devkit/build-angular": "^17.3.3",
"@angular/cli": "^17.3.3",
"@angular/compiler-cli": "^17.3.3",
"@tanstack/angular-query-devtools-experimental": "^5.35.3",
"@tanstack/angular-query-devtools-experimental": "^5.35.4",
"typescript": "5.2.2"
}
}
4 changes: 2 additions & 2 deletions examples/angular/router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@angular/platform-browser": "^17.3.3",
"@angular/platform-browser-dynamic": "^17.3.3",
"@angular/router": "^17.3.3",
"@tanstack/angular-query-experimental": "^5.35.3",
"@tanstack/angular-query-experimental": "^5.35.4",
"rxjs": "^7.8.1",
"tslib": "^2.6.2",
"zone.js": "^0.14.4"
Expand All @@ -26,7 +26,7 @@
"@angular-devkit/build-angular": "^17.3.3",
"@angular/cli": "^17.3.3",
"@angular/compiler-cli": "^17.3.3",
"@tanstack/angular-query-devtools-experimental": "^5.35.3",
"@tanstack/angular-query-devtools-experimental": "^5.35.4",
"typescript": "5.2.2"
}
}
4 changes: 2 additions & 2 deletions examples/angular/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@angular/platform-browser": "^17.3.3",
"@angular/platform-browser-dynamic": "^17.3.3",
"@angular/router": "^17.3.3",
"@tanstack/angular-query-experimental": "^5.35.3",
"@tanstack/angular-query-experimental": "^5.35.4",
"rxjs": "^7.8.1",
"tslib": "^2.6.2",
"zone.js": "^0.14.4"
Expand All @@ -26,7 +26,7 @@
"@angular-devkit/build-angular": "^17.3.3",
"@angular/cli": "^17.3.3",
"@angular/compiler-cli": "^17.3.3",
"@tanstack/angular-query-devtools-experimental": "^5.35.3",
"@tanstack/angular-query-devtools-experimental": "^5.35.4",
"typescript": "5.2.2"
}
}
4 changes: 2 additions & 2 deletions examples/react/algolia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"dependencies": {
"@algolia/client-search": "4.22.1",
"@algolia/transporter": "4.22.1",
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"algoliasearch": "4.22.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/react/auto-refetching/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"axios": "^1.6.7",
"isomorphic-unfetch": "4.0.2",
"next": "^14.0.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/basic-graphql-request/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"graphql": "^16.8.1",
"graphql-request": "^6.1.0",
"react": "^18.2.0",
Expand Down
8 changes: 4 additions & 4 deletions examples/react/basic-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/query-sync-storage-persister": "^5.35.1",
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query-persist-client": "^5.35.1",
"@tanstack/query-sync-storage-persister": "^5.35.4",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"@tanstack/react-query-persist-client": "^5.35.4",
"axios": "^1.6.7",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/react/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"axios": "^1.6.7",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/react/default-query-function/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"axios": "^1.6.7",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/react/infinite-query-with-max-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"axios": "^1.6.7",
"isomorphic-unfetch": "4.0.2",
"next": "^14.0.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/load-more-infinite-scroll/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"axios": "^1.6.7",
"isomorphic-unfetch": "4.0.2",
"next": "^14.0.0",
Expand Down
6 changes: 3 additions & 3 deletions examples/react/nextjs-suspense-streaming/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query-next-experimental": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"@tanstack/react-query-next-experimental": "^5.35.4",
"next": "^14.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"ky": "^1.2.0",
"next": "^14.0.0",
"react": "^18.2.0",
Expand Down
8 changes: 4 additions & 4 deletions examples/react/offline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/query-sync-storage-persister": "^5.35.1",
"@tanstack/query-sync-storage-persister": "^5.35.4",
"@tanstack/react-location": "^3.7.4",
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query-persist-client": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"@tanstack/react-query-persist-client": "^5.35.4",
"ky": "^1.2.0",
"msw": "^2.1.7",
"react": "^18.2.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/optimistic-updates-cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"axios": "^1.6.7",
"isomorphic-unfetch": "4.0.2",
"next": "^14.0.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/optimistic-updates-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"axios": "^1.6.7",
"isomorphic-unfetch": "4.0.2",
"next": "^14.0.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/pagination/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"axios": "^1.6.7",
"isomorphic-unfetch": "4.0.2",
"next": "^14.0.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/react/prefetching/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"axios": "^1.6.7",
"isomorphic-unfetch": "4.0.2",
"next": "^14.0.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"@react-native-community/netinfo": "^11.1.0",
"@react-navigation/native": "^6.1.6",
"@react-navigation/stack": "^6.3.16",
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"expo": "^50.0.6",
"expo-constants": "^15.4.5",
"expo-status-bar": "^1.11.1",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/react-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"localforage": "^1.10.0",
"match-sorter": "^6.3.4",
"react": "^18.2.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/rick-morty/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"@emotion/styled": "^11.11.0",
"@mui/material": "^5.15.2",
"@mui/styles": "^5.15.2",
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router": "^6.22.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/shadow-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/react/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"axios": "^1.6.7",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/react/star-wars/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"@emotion/styled": "^11.11.0",
"@mui/material": "^5.15.2",
"@mui/styles": "^5.15.2",
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router": "^6.22.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/suspense/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"private": true,
"type": "module",
"dependencies": {
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.35.4",
"@tanstack/react-query-devtools": "^5.35.4",
"axios": "^1.6.7",
"font-awesome": "^4.7.0",
"react": "^18.2.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/solid/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"@astrojs/tailwind": "^5.1.0",
"@astrojs/vercel": "^7.5.3",
"@astrojs/node": "^8.2.5",
"@tanstack/solid-query": "^5.35.1",
"@tanstack/solid-query-devtools": "^5.35.1",
"@tanstack/solid-query": "^5.35.4",
"@tanstack/solid-query-devtools": "^5.35.4",
"astro": "^4.6.1",
"solid-js": "^1.8.14",
"tailwindcss": "^3.4.1",
Expand Down
4 changes: 2 additions & 2 deletions examples/solid/basic-graphql-request/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/solid-query": "^5.35.1",
"@tanstack/solid-query-devtools": "^5.35.1",
"@tanstack/solid-query": "^5.35.4",
"@tanstack/solid-query-devtools": "^5.35.4",
"graphql": "^16.8.1",
"graphql-request": "^6.1.0",
"solid-js": "^1.8.14"
Expand Down

0 comments on commit e2bc5cb

Please sign in to comment.