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.51.17
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.51.18
Choose a head ref
  • 2 commits
  • 38 files changed
  • 4 contributors

Commits on Aug 1, 2024

  1. fix(query-options): allow returning undefined in initialData function (

    …#7351)
    
    * Fix PR
    
    * Fix for react adapter
    
    * ci: apply automated fixes
    
    ---------
    
    Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
    3 people authored Aug 1, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    fdb8ce1 View commit details
  2. release: v5.51.18

    tannerlinsley committed Aug 1, 2024
    Copy the full SHA
    23c3da2 View commit details
Showing with 172 additions and 124 deletions.
  1. +2 −2 examples/angular/basic/package.json
  2. +2 −2 examples/angular/infinite-query-with-max-pages/package.json
  3. +2 −2 examples/angular/router/package.json
  4. +2 −2 examples/angular/simple/package.json
  5. +2 −2 examples/react/algolia/package.json
  6. +2 −2 examples/react/auto-refetching/package.json
  7. +2 −2 examples/react/basic-graphql-request/package.json
  8. +3 −3 examples/react/basic/package.json
  9. +2 −2 examples/react/default-query-function/package.json
  10. +2 −2 examples/react/infinite-query-with-max-pages/package.json
  11. +2 −2 examples/react/load-more-infinite-scroll/package.json
  12. +2 −2 examples/react/nextjs-app-prefetching/package.json
  13. +3 −3 examples/react/nextjs-suspense-streaming/package.json
  14. +2 −2 examples/react/nextjs/package.json
  15. +3 −3 examples/react/offline/package.json
  16. +2 −2 examples/react/optimistic-updates-cache/package.json
  17. +2 −2 examples/react/optimistic-updates-ui/package.json
  18. +2 −2 examples/react/pagination/package.json
  19. +2 −2 examples/react/playground/package.json
  20. +2 −2 examples/react/prefetching/package.json
  21. +2 −2 examples/react/react-native/package.json
  22. +2 −2 examples/react/react-router/package.json
  23. +2 −2 examples/react/rick-morty/package.json
  24. +2 −2 examples/react/shadow-dom/package.json
  25. +2 −2 examples/react/simple/package.json
  26. +2 −2 examples/react/star-wars/package.json
  27. +2 −2 examples/react/suspense/package.json
  28. +1 −1 packages/angular-query-devtools-experimental/package.json
  29. +1 −1 packages/angular-query-experimental/package.json
  30. +19 −0 packages/angular-query-experimental/src/__tests__/query-options.test-d.ts
  31. +7 −2 packages/angular-query-experimental/src/query-options.ts
  32. +1 −1 packages/react-query-devtools/package.json
  33. +1 −1 packages/react-query-next-experimental/package.json
  34. +1 −1 packages/react-query-persist-client/package.json
  35. +1 −1 packages/react-query/package.json
  36. +19 −0 packages/react-query/src/__tests__/queryOptions.test-d.tsx
  37. +7 −2 packages/react-query/src/queryOptions.ts
  38. +57 −57 pnpm-lock.yaml
4 changes: 2 additions & 2 deletions examples/angular/basic/package.json
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
"@angular/core": "^17.3.12",
"@angular/platform-browser": "^17.3.12",
"@angular/platform-browser-dynamic": "^17.3.12",
"@tanstack/angular-query-experimental": "^5.51.17",
"@tanstack/angular-query-experimental": "^5.51.18",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
"zone.js": "^0.14.8"
@@ -23,7 +23,7 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.12",
"@tanstack/angular-query-devtools-experimental": "^5.51.17",
"@tanstack/angular-query-devtools-experimental": "^5.51.18",
"typescript": "5.3.3"
}
}
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
@@ -14,7 +14,7 @@
"@angular/core": "^17.3.12",
"@angular/platform-browser": "^17.3.12",
"@angular/platform-browser-dynamic": "^17.3.12",
"@tanstack/angular-query-experimental": "^5.51.17",
"@tanstack/angular-query-experimental": "^5.51.18",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
"zone.js": "^0.14.8"
@@ -23,7 +23,7 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.12",
"@tanstack/angular-query-devtools-experimental": "^5.51.17",
"@tanstack/angular-query-devtools-experimental": "^5.51.18",
"typescript": "5.3.3"
}
}
4 changes: 2 additions & 2 deletions examples/angular/router/package.json
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
"@angular/platform-browser": "^17.3.12",
"@angular/platform-browser-dynamic": "^17.3.12",
"@angular/router": "^17.3.12",
"@tanstack/angular-query-experimental": "^5.51.17",
"@tanstack/angular-query-experimental": "^5.51.18",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
"zone.js": "^0.14.8"
@@ -24,7 +24,7 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.12",
"@tanstack/angular-query-devtools-experimental": "^5.51.17",
"@tanstack/angular-query-devtools-experimental": "^5.51.18",
"typescript": "5.3.3"
}
}
4 changes: 2 additions & 2 deletions examples/angular/simple/package.json
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
"@angular/platform-browser": "^17.3.12",
"@angular/platform-browser-dynamic": "^17.3.12",
"@angular/router": "^17.3.12",
"@tanstack/angular-query-experimental": "^5.51.17",
"@tanstack/angular-query-experimental": "^5.51.18",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
"zone.js": "^0.14.8"
@@ -24,7 +24,7 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.12",
"@tanstack/angular-query-devtools-experimental": "^5.51.17",
"@tanstack/angular-query-devtools-experimental": "^5.51.18",
"typescript": "5.3.3"
}
}
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.24.0",
"@algolia/transporter": "4.24.0",
"@tanstack/react-query": "^5.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"algoliasearch": "4.24.0",
"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
@@ -8,8 +8,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"next": "^14.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.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.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"graphql": "^16.9.0",
"graphql-request": "^7.1.0",
"react": "19.0.0-rc-4c2e457c7c-20240522",
6 changes: 3 additions & 3 deletions examples/react/basic/package.json
Original file line number Diff line number Diff line change
@@ -10,9 +10,9 @@
},
"dependencies": {
"@tanstack/query-sync-storage-persister": "^5.51.17",
"@tanstack/react-query": "^5.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query-persist-client": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"@tanstack/react-query-persist-client": "^5.51.18",
"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.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"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
@@ -8,8 +8,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"next": "^14.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.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
@@ -8,8 +8,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"next": "^14.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
4 changes: 2 additions & 2 deletions examples/react/nextjs-app-prefetching/package.json
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/react-query": "^5.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"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
@@ -9,9 +9,9 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/react-query": "^5.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query-next-experimental": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"@tanstack/react-query-next-experimental": "^5.51.18",
"next": "^14.2.5",
"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
@@ -8,8 +8,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"next": "^14.2.5",
"react": "^18.2.0",
"react-dom": "^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.51.17",
"@tanstack/react-location": "^3.7.4",
"@tanstack/react-query": "^5.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query-persist-client": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"@tanstack/react-query-persist-client": "^5.51.18",
"msw": "^2.3.4",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "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
@@ -9,8 +9,8 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/react-query": "^5.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"next": "^14.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
4 changes: 2 additions & 2 deletions examples/react/optimistic-updates-ui/package.json
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"next": "^14.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
4 changes: 2 additions & 2 deletions examples/react/pagination/package.json
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"next": "^14.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.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.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"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
@@ -8,8 +8,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"next": "^14.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.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.2",
"@react-navigation/native": "^6.1.18",
"@react-navigation/stack": "^6.4.1",
"@tanstack/react-query": "^5.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"expo": "^51.0.22",
"expo-constants": "^16.0.2",
"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.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"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.13.0",
"@mui/material": "^5.16.5",
"@mui/styles": "^5.16.5",
"@tanstack/react-query": "^5.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522",
"react-router": "^6.25.1",
4 changes: 2 additions & 2 deletions examples/react/shadow-dom/package.json
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"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.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"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.13.0",
"@mui/material": "^5.16.5",
"@mui/styles": "^5.16.5",
"@tanstack/react-query": "^5.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522",
"react-router": "^6.25.1",
4 changes: 2 additions & 2 deletions examples/react/suspense/package.json
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.51.17",
"@tanstack/react-query-devtools": "^5.51.17",
"@tanstack/react-query": "^5.51.18",
"@tanstack/react-query-devtools": "^5.51.18",
"font-awesome": "^4.7.0",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522",
2 changes: 1 addition & 1 deletion packages/angular-query-devtools-experimental/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/angular-query-devtools-experimental",
"version": "5.51.17",
"version": "5.51.18",
"description": "Developer tools to interact with and visualize the TanStack/angular-query cache",
"author": "Arnoud de Vries",
"license": "MIT",
2 changes: 1 addition & 1 deletion packages/angular-query-experimental/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/angular-query-experimental",
"version": "5.51.17",
"version": "5.51.18",
"description": "Signals for managing, caching and syncing asynchronous and remote data in Angular",
"author": "Arnoud de Vries",
"license": "MIT",
Original file line number Diff line number Diff line change
@@ -22,6 +22,25 @@ describe('queryOptions', () => {
},
})
})

test('should allow undefined response in initialData', () => {
return (id: string | null) =>
queryOptions({
queryKey: ['todo', id],
queryFn: () =>
Promise.resolve({
id: '1',
title: 'Do Laundry',
}),
initialData: () =>
!id
? undefined
: {
id,
title: 'Initial Data',
},
})
})
})

test('should work when passed to injectQuery', () => {
9 changes: 7 additions & 2 deletions packages/angular-query-experimental/src/query-options.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import type { DataTag, DefaultError, QueryKey } from '@tanstack/query-core'
import type {
DataTag,
DefaultError,
InitialDataFunction,
QueryKey,
} from '@tanstack/query-core'
import type { CreateQueryOptions, NonUndefinedGuard } from './types'

/**
@@ -10,7 +15,7 @@ export type UndefinedInitialDataOptions<
TData = TQueryFnData,
TQueryKey extends QueryKey = QueryKey,
> = CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
initialData?: undefined
initialData?: undefined | InitialDataFunction<NonUndefinedGuard<TQueryFnData>>
}

/**
Loading