Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: TanStack/query
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.45.0
Choose a base ref
...
head repository: TanStack/query
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.45.1
Choose a head ref
  • 3 commits
  • 32 files changed
  • 4 contributors

Commits on Jun 15, 2024

  1. docs: fix grammar mistake on migrating-to-v5.md (#7556)

    Fixed grammar mistake on migrating-to-v5.md
    
    Very small change but makes the documentation better than it already is
    pashioya authored Jun 15, 2024
    1
    Copy the full SHA
    8d69ef4 View commit details

Commits on Jun 16, 2024

  1. refactor(react-query): improve type inference for useSuspenseQueries …

    …with skipToken (#7564)
    
    Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
    gwansikk and TkDodo authored Jun 16, 2024
    Copy the full SHA
    77a7b28 View commit details
  2. release: v5.45.1

    tannerlinsley committed Jun 16, 2024
    Copy the full SHA
    80a0322 View commit details
Showing with 137 additions and 115 deletions.
  1. +2 −2 docs/framework/react/guides/migrating-to-v5.md
  2. +2 −2 examples/react/algolia/package.json
  3. +2 −2 examples/react/auto-refetching/package.json
  4. +2 −2 examples/react/basic-graphql-request/package.json
  5. +3 −3 examples/react/basic-typescript/package.json
  6. +2 −2 examples/react/basic/package.json
  7. +2 −2 examples/react/default-query-function/package.json
  8. +2 −2 examples/react/infinite-query-with-max-pages/package.json
  9. +2 −2 examples/react/load-more-infinite-scroll/package.json
  10. +2 −2 examples/react/nextjs-app-prefetching/package.json
  11. +3 −3 examples/react/nextjs-suspense-streaming/package.json
  12. +2 −2 examples/react/nextjs/package.json
  13. +3 −3 examples/react/offline/package.json
  14. +2 −2 examples/react/optimistic-updates-cache/package.json
  15. +2 −2 examples/react/optimistic-updates-ui/package.json
  16. +2 −2 examples/react/pagination/package.json
  17. +2 −2 examples/react/playground/package.json
  18. +2 −2 examples/react/prefetching/package.json
  19. +2 −2 examples/react/react-native/package.json
  20. +2 −2 examples/react/react-router/package.json
  21. +2 −2 examples/react/rick-morty/package.json
  22. +2 −2 examples/react/shadow-dom/package.json
  23. +2 −2 examples/react/simple/package.json
  24. +2 −2 examples/react/star-wars/package.json
  25. +2 −2 examples/react/suspense/package.json
  26. +1 −1 packages/react-query-devtools/package.json
  27. +1 −1 packages/react-query-next-experimental/package.json
  28. +1 −1 packages/react-query-persist-client/package.json
  29. +1 −1 packages/react-query/package.json
  30. +20 −2 packages/react-query/src/__tests__/useSuspenseQueries.test-d.tsx
  31. +9 −5 packages/react-query/src/useSuspenseQueries.ts
  32. +51 −51 pnpm-lock.yaml
4 changes: 2 additions & 2 deletions docs/framework/react/guides/migrating-to-v5.md
Original file line number Diff line number Diff line change
@@ -179,7 +179,7 @@ TanStack Query has always had private fields and methods on classes, but they we

Almost everyone gets `cacheTime` wrong. It sounds like "the amount of time that data is cached for", but that is not correct.

`cacheTime` does nothing as long as a query is still in used. It only kicks in as soon as the query becomes unused. After the time has passed, data will be "garbage collected" to avoid the cache from growing.
`cacheTime` does nothing as long as a query is still in use. It only kicks in as soon as the query becomes unused. After the time has passed, data will be "garbage collected" to avoid the cache from growing.

`gc` is referring to "garbage collect" time. It's a bit more technical, but also a quite [well known abbreviation](<https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)>) in computer science.

@@ -365,7 +365,7 @@ For mutations as well the `status` has been changed from `loading` to `pending`

Lastly, a new derived `isLoading` flag has been added to the queries that is implemented as `isPending && isFetching`. This means that `isLoading` and `isInitialLoading` have the same thing, but `isInitialLoading` is deprecated now and will be removed in the next major version.

To understand the reasoning behing this change checkout the [v5 roadmap discussion](https://github.com/TanStack/query/discussions/4252).
To understand the reasoning behind this change checkout the [v5 roadmap discussion](https://github.com/TanStack/query/discussions/4252).

### `hashQueryKey` has been renamed to `hashKey`

4 changes: 2 additions & 2 deletions examples/react/algolia/package.json
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@
"dependencies": {
"@algolia/client-search": "4.23.3",
"@algolia/transporter": "4.23.3",
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"algoliasearch": "4.23.3",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
4 changes: 2 additions & 2 deletions examples/react/auto-refetching/package.json
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"axios": "^1.6.8",
"isomorphic-unfetch": "4.0.2",
"next": "^14.0.0",
4 changes: 2 additions & 2 deletions examples/react/basic-graphql-request/package.json
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"graphql": "^16.8.1",
"graphql-request": "^7.0.1",
"react": "19.0.0-rc-4c2e457c7c-20240522",
6 changes: 3 additions & 3 deletions examples/react/basic-typescript/package.json
Original file line number Diff line number Diff line change
@@ -10,9 +10,9 @@
},
"dependencies": {
"@tanstack/query-sync-storage-persister": "^5.45.0",
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query-persist-client": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"@tanstack/react-query-persist-client": "^5.45.1",
"axios": "^1.6.8",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
4 changes: 2 additions & 2 deletions examples/react/basic/package.json
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"axios": "^1.6.8",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
4 changes: 2 additions & 2 deletions examples/react/default-query-function/package.json
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"axios": "^1.6.8",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
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
@@ -7,8 +7,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"axios": "^1.6.8",
"isomorphic-unfetch": "4.0.2",
"next": "^14.0.0",
4 changes: 2 additions & 2 deletions examples/react/load-more-infinite-scroll/package.json
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"axios": "^1.6.8",
"isomorphic-unfetch": "4.0.2",
"next": "^14.0.0",
4 changes: 2 additions & 2 deletions examples/react/nextjs-app-prefetching/package.json
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"next": "^15.0.0-rc.0",
"react": "^19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "^19.0.0-rc-4c2e457c7c-20240522"
6 changes: 3 additions & 3 deletions examples/react/nextjs-suspense-streaming/package.json
Original file line number Diff line number Diff line change
@@ -8,9 +8,9 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query-next-experimental": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"@tanstack/react-query-next-experimental": "^5.45.1",
"next": "^14.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
4 changes: 2 additions & 2 deletions examples/react/nextjs/package.json
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"ky": "^1.2.4",
"next": "^14.0.0",
"react": "^18.2.0",
6 changes: 3 additions & 3 deletions examples/react/offline/package.json
Original file line number Diff line number Diff line change
@@ -10,9 +10,9 @@
"dependencies": {
"@tanstack/query-sync-storage-persister": "^5.45.0",
"@tanstack/react-location": "^3.7.4",
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query-persist-client": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"@tanstack/react-query-persist-client": "^5.45.1",
"ky": "^1.2.4",
"msw": "^2.3.0",
"react": "19.0.0-rc-4c2e457c7c-20240522",
4 changes: 2 additions & 2 deletions examples/react/optimistic-updates-cache/package.json
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"axios": "^1.6.8",
"isomorphic-unfetch": "4.0.2",
"next": "^14.0.0",
4 changes: 2 additions & 2 deletions examples/react/optimistic-updates-ui/package.json
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"axios": "^1.6.8",
"isomorphic-unfetch": "4.0.2",
"next": "^14.0.0",
4 changes: 2 additions & 2 deletions examples/react/pagination/package.json
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"axios": "^1.6.8",
"isomorphic-unfetch": "4.0.2",
"next": "^14.0.0",
4 changes: 2 additions & 2 deletions examples/react/playground/package.json
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
},
4 changes: 2 additions & 2 deletions examples/react/prefetching/package.json
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"axios": "^1.6.8",
"isomorphic-unfetch": "4.0.2",
"next": "^14.0.0",
4 changes: 2 additions & 2 deletions examples/react/react-native/package.json
Original file line number Diff line number Diff line change
@@ -14,8 +14,8 @@
"@react-native-community/netinfo": "^11.3.1",
"@react-navigation/native": "^6.1.6",
"@react-navigation/stack": "^6.3.16",
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"expo": "^51.0.8",
"expo-constants": "^16.0.1",
"expo-status-bar": "^1.12.1",
4 changes: 2 additions & 2 deletions examples/react/react-router/package.json
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"localforage": "^1.10.0",
"match-sorter": "^6.3.4",
"react": "19.0.0-rc-4c2e457c7c-20240522",
4 changes: 2 additions & 2 deletions examples/react/rick-morty/package.json
Original file line number Diff line number Diff line change
@@ -12,8 +12,8 @@
"@emotion/styled": "^11.11.5",
"@mui/material": "^5.15.18",
"@mui/styles": "^5.15.18",
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522",
"react-router": "^6.23.1",
4 changes: 2 additions & 2 deletions examples/react/shadow-dom/package.json
Original file line number Diff line number Diff line change
@@ -10,8 +10,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
},
4 changes: 2 additions & 2 deletions examples/react/simple/package.json
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"axios": "^1.6.8",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
4 changes: 2 additions & 2 deletions examples/react/star-wars/package.json
Original file line number Diff line number Diff line change
@@ -12,8 +12,8 @@
"@emotion/styled": "^11.11.5",
"@mui/material": "^5.15.18",
"@mui/styles": "^5.15.18",
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522",
"react-router": "^6.23.1",
4 changes: 2 additions & 2 deletions examples/react/suspense/package.json
Original file line number Diff line number Diff line change
@@ -3,8 +3,8 @@
"private": true,
"type": "module",
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-query-devtools": "^5.45.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.45.1",
"axios": "^1.6.8",
"font-awesome": "^4.7.0",
"react": "19.0.0-rc-4c2e457c7c-20240522",
2 changes: 1 addition & 1 deletion packages/react-query-devtools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/react-query-devtools",
"version": "5.45.0",
"version": "5.45.1",
"description": "Developer tools to interact with and visualize the TanStack/react-query cache",
"author": "tannerlinsley",
"license": "MIT",
2 changes: 1 addition & 1 deletion packages/react-query-next-experimental/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/react-query-next-experimental",
"version": "5.45.0",
"version": "5.45.1",
"description": "Hydration utils for React Query in the NextJs app directory",
"author": "tannerlinsley",
"license": "MIT",
2 changes: 1 addition & 1 deletion packages/react-query-persist-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/react-query-persist-client",
"version": "5.45.0",
"version": "5.45.1",
"description": "React bindings to work with persisters in TanStack/react-query",
"author": "tannerlinsley",
"license": "MIT",
2 changes: 1 addition & 1 deletion packages/react-query/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/react-query",
"version": "5.45.0",
"version": "5.45.1",
"description": "Hooks for managing, caching and syncing asynchronous and remote data in React",
"author": "tannerlinsley",
"license": "MIT",
22 changes: 20 additions & 2 deletions packages/react-query/src/__tests__/useSuspenseQueries.test-d.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, expectTypeOf, it } from 'vitest'
import { useSuspenseQueries } from '..'
import { skipToken, useSuspenseQueries } from '..'
import { queryOptions } from '../queryOptions'
import type { OmitKeyof } from '..'
import type { UseQueryOptions } from '../types'
import type { UseQueryOptions, UseSuspenseQueryResult } from '../types'

describe('UseSuspenseQueries config object overload', () => {
it('TData should always be defined', () => {
@@ -113,4 +113,22 @@ describe('UseSuspenseQueries config object overload', () => {
expectTypeOf(data).toEqualTypeOf<Data>()
})
})

it('TData should have correct type when conditional skipToken is passed', () => {
const queryResults = useSuspenseQueries({
queries: [
{
queryKey: ['withSkipToken'],
queryFn: Math.random() > 0.5 ? skipToken : () => Promise.resolve(5),
},
],
})

const firstResult = queryResults[0]

expectTypeOf(firstResult).toEqualTypeOf<
UseSuspenseQueryResult<number, Error>
>()
expectTypeOf(firstResult.data).toEqualTypeOf<number>()
})
})
Loading