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.50.1
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.1
Choose a head ref
  • 17 commits
  • 213 files changed
  • 7 contributors

Commits on Jul 5, 2024

  1. ci: Add preview workflow (#7675)

    * ci: Add preview workflow
    
    * Mark query-codemods as private
    
    * Ignore query-codemods for CSB
    
    * Test templates
    
    * Fix templates glob
    
    * Fix private fields
    
    * Move --compact
    
    * One of these will work
    
    * One more attempt
    
    * Adjust command
    
    * Specific template
    
    * Remove private...
    
    * no-template
    lachlancollins authored Jul 5, 2024
    Copy the full SHA
    2273105 View commit details

Commits on Jul 6, 2024

  1. ci: Use pkg-pr-new templates (#7676)

    * WIP: Try pkg-pr-new templates
    
    * Remove approved
    
    * Try one dir
    
    * Update preview.yml
    
    * Update preview.yml
    
    * Update preview.yml
    
    * Test moving to dep
    
    * Merge with pr.yml
    
    * Update example names
    
    * Use pnpm pack
    
    * All examples
    
    * Undo angular basic change
    
    * Remove .codesandbox/ci.json
    lachlancollins authored Jul 6, 2024
    Copy the full SHA
    ea4d8f2 View commit details
  2. fix(solid): Correct deps/devDeps/peerDeps (#7682)

    lachlancollins authored Jul 6, 2024
    Copy the full SHA
    9e5bc7b View commit details
  3. release: v5.50.2

    tannerlinsley committed Jul 6, 2024
    Copy the full SHA
    706bce3 View commit details
  4. docs(examples): Fix duplicate example name (#7684)

    lachlancollins authored Jul 6, 2024
    Copy the full SHA
    d2a92d9 View commit details

Commits on Jul 8, 2024

  1. refactor(svelte-query): specify StoreOrVal in function signature (#7453)

    Co-authored-by: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com>
    ap0nia and lachlancollins authored Jul 8, 2024
    Copy the full SHA
    2df92a6 View commit details
  2. docs(react-query): correct links in the prefetching.md file (#7671)

    Co-authored-by: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com>
    87xie and lachlancollins authored Jul 8, 2024
    Copy the full SHA
    c107fc5 View commit details
  3. release: v5.50.3

    tannerlinsley committed Jul 8, 2024
    Copy the full SHA
    c1945ff View commit details
  4. feat(vue-query): add support for getters in query keys (#7608)

    * feat(vue-query): add support for getters in query keys
    
    * add support for nested queries
    
    * fix type test
    
    * don't export helper function
    
    * fix useQueries types
    
    * fix lint issue
    suneettipirneni authored Jul 8, 2024
    Copy the full SHA
    41009c9 View commit details
  5. release: v5.51.0

    tannerlinsley committed Jul 8, 2024
    Copy the full SHA
    7e3c9e9 View commit details
  6. docs: add Query Rewind to vue community projects (#7688)

    johnwdunn20 authored Jul 8, 2024
    Copy the full SHA
    14d9c49 View commit details

Commits on Jul 9, 2024

  1. ci: Improve Nx inputs (#7702)

    lachlancollins authored Jul 9, 2024
    Copy the full SHA
    362f8e6 View commit details

Commits on Jul 10, 2024

  1. docs(examples): Modernise React examples (#7704)

    * docs(examples): Update react/basic-typescript
    
    * Replace basic with basic-typescript
    
    * Fix lockfile
    
    * Update react/basic-graphql-request
    
    * Improve react/suspense
    
    * More tweaks to react/suspense
    
    * Update react/simple
    
    * Update react/offline
    
    * Convert default-query-function
    
    * Remove axios and ky usage
    
    * Replace axios with fetch
    
    * Undo lint-stagesd
    
    * Sync solid/basic and solid/basic-graphql-request
    lachlancollins authored Jul 10, 2024
    Copy the full SHA
    7fc9472 View commit details
  2. docs(eslint-plugin-query): Fix rules links (#7705)

    twiddler authored Jul 10, 2024
    Copy the full SHA
    8d0ba7e View commit details
  3. docs(examples): Modernise Next.js examples (#7706)

    * docs(examples): Update react/auto-refetching
    
    * Update infinite-query-with-max-pages, load-more-infinite-scroll
    
    * Upgrade react/nextjs
    
    * More projects
    
    * Update playground
    
    * Update prefetching
    
    * Cleanup deps
    
    * Disable typescript during next build
    
    * Fix eslint plugin
    
    * Final changes
    lachlancollins authored Jul 10, 2024
    Copy the full SHA
    b58da75 View commit details

Commits on Jul 11, 2024

  1. ci: enable npm provenance (#7716)

    * ci: enable npm provenance
    
    * Update @tanstack/config
    lachlancollins authored Jul 11, 2024
    Copy the full SHA
    c6d68d8 View commit details
  2. release: v5.51.1

    tannerlinsley committed Jul 11, 2024
    Copy the full SHA
    9726af3 View commit details
Showing with 1,740 additions and 1,640 deletions.
  1. +0 −12 .codesandbox/ci.json
  2. +6 −2 .github/workflows/ci.yml
  3. +19 −2 .github/workflows/pr.yml
  4. +1 −0 .npmrc
  5. +1 −1 .nvmrc
  6. +1 −1 docs/config.json
  7. +2 −2 docs/eslint/eslint-plugin-query.md
  8. +2 −2 docs/framework/react/guides/prefetching.md
  9. +6 −0 docs/framework/vue/community/community-projects.md
  10. +2 −2 examples/angular/basic/package.json
  11. +4 −4 examples/angular/infinite-query-with-max-pages/package.json
  12. +2 −2 examples/angular/router/package.json
  13. +2 −2 examples/angular/simple/package.json
  14. +3 −15 examples/react/algolia/package.json
  15. +5 −0 examples/react/auto-refetching/next-env.d.ts
  16. +3 −0 examples/react/auto-refetching/next.config.js
  17. +7 −4 examples/react/auto-refetching/package.json
  18. +6 −1 examples/react/auto-refetching/src/pages/api/{data.js → data.ts}
  19. +8 −11 examples/react/auto-refetching/src/pages/{index.js → index.tsx}
  20. +19 −0 examples/react/auto-refetching/tsconfig.json
  21. +0 −3 examples/react/basic-graphql-request/.eslintrc
  22. 0 examples/react/{basic-typescript → basic-graphql-request}/eslint.config.js
  23. +1 −1 examples/react/basic-graphql-request/index.html
  24. +2 −14 examples/react/basic-graphql-request/package.json
  25. +30 −16 examples/react/basic-graphql-request/src/{index.jsx → index.tsx}
  26. 0 examples/react/{basic-typescript → basic-graphql-request}/tsconfig.json
  27. +0 −27 examples/react/basic-typescript/.gitignore
  28. +0 −6 examples/react/basic-typescript/README.md
  29. +0 −16 examples/react/basic-typescript/index.html
  30. +0 −42 examples/react/basic-typescript/package.json
  31. +0 −13 examples/react/basic-typescript/public/emblem-light.svg
  32. +0 −7 examples/react/basic/.eslintrc
  33. +19 −0 examples/react/basic/eslint.config.js
  34. +1 −1 examples/react/basic/index.html
  35. +11 −17 examples/react/basic/package.json
  36. +0 −138 examples/react/basic/src/index.jsx
  37. +12 −19 examples/react/{basic-typescript → basic}/src/index.tsx
  38. +24 −0 examples/react/basic/tsconfig.json
  39. 0 examples/react/{basic-typescript → basic}/vite.config.ts
  40. +1 −1 examples/react/default-query-function/index.html
  41. +3 −15 examples/react/default-query-function/package.json
  42. +28 −12 examples/react/default-query-function/src/{index.jsx → index.tsx}
  43. +24 −0 examples/react/default-query-function/tsconfig.json
  44. +6 −0 examples/react/default-query-function/vite.config.ts
  45. +5 −0 examples/react/infinite-query-with-max-pages/next-env.d.ts
  46. +3 −0 examples/react/infinite-query-with-max-pages/next.config.js
  47. +8 −6 examples/react/infinite-query-with-max-pages/package.json
  48. +3 −2 examples/react/infinite-query-with-max-pages/src/pages/api/{projects.js → projects.ts}
  49. +3 −4 examples/react/infinite-query-with-max-pages/src/pages/{index.js → index.tsx}
  50. +19 −0 examples/react/infinite-query-with-max-pages/tsconfig.json
  51. +5 −0 examples/react/load-more-infinite-scroll/next-env.d.ts
  52. +3 −0 examples/react/load-more-infinite-scroll/next.config.js
  53. +7 −4 examples/react/load-more-infinite-scroll/package.json
  54. 0 examples/react/load-more-infinite-scroll/src/pages/{about.js → about.tsx}
  55. +3 −2 examples/react/load-more-infinite-scroll/src/pages/api/{projects.js → projects.ts}
  56. +11 −6 examples/react/load-more-infinite-scroll/src/pages/{index.js → index.tsx}
  57. +19 −0 examples/react/load-more-infinite-scroll/tsconfig.json
  58. +3 −0 examples/react/nextjs-app-prefetching/next.config.js
  59. +5 −6 examples/react/nextjs-app-prefetching/package.json
  60. +3 −0 examples/react/nextjs-suspense-streaming/next.config.js
  61. +4 −6 examples/react/nextjs-suspense-streaming/package.json
  62. +5 −0 examples/react/nextjs/next-env.d.ts
  63. +3 −0 examples/react/nextjs/next.config.js
  64. +8 −6 examples/react/nextjs/package.json
  65. 0 examples/react/nextjs/src/components/{Header/index.js → Header.tsx}
  66. +1 −1 examples/react/nextjs/src/components/{InfoBox/index.js → InfoBox.tsx}
  67. +1 −1 examples/react/nextjs/src/components/{Layout/index.js → Layout.tsx}
  68. +2 −5 examples/react/nextjs/src/components/{PostList/index.js → PostList.tsx}
  69. examples/react/nextjs/src/components/{index.js → index.ts}
  70. +0 −1 examples/react/nextjs/src/hooks/index.js
  71. +22 −0 examples/react/nextjs/src/hooks/usePosts.ts
  72. +0 −16 examples/react/nextjs/src/hooks/usePosts/index.js
  73. +2 −1 examples/react/nextjs/src/pages/{_app.js → _app.tsx}
  74. +1 −1 examples/react/nextjs/src/pages/{client-only.js → client-only.tsx}
  75. +3 −3 examples/react/nextjs/src/pages/{index.js → index.tsx}
  76. +19 −0 examples/react/nextjs/tsconfig.json
  77. +1 −1 examples/react/offline/index.html
  78. +5 −17 examples/react/offline/package.json
  79. +4 −6 examples/react/offline/src/{App.jsx → App.tsx}
  80. +0 −63 examples/react/offline/src/api.js
  81. +84 −0 examples/react/offline/src/api.ts
  82. +1 −1 examples/react/offline/src/{index.jsx → index.tsx}
  83. +4 −4 examples/react/offline/src/{movies.js → movies.ts}
  84. +24 −0 examples/react/offline/tsconfig.json
  85. +6 −0 examples/react/offline/vite.config.ts
  86. +3 −0 examples/react/optimistic-updates-cache/next.config.js
  87. +2 −5 examples/react/optimistic-updates-cache/package.json
  88. +7 −3 examples/react/optimistic-updates-cache/src/pages/api/{data.js → data.ts}
  89. +15 −9 examples/react/optimistic-updates-cache/src/pages/index.tsx
  90. +3 −0 examples/react/optimistic-updates-ui/next.config.js
  91. +2 −5 examples/react/optimistic-updates-ui/package.json
  92. +7 −3 examples/react/optimistic-updates-ui/src/pages/api/{data.js → data.ts}
  93. +15 −10 examples/react/optimistic-updates-ui/src/pages/index.tsx
  94. +5 −0 examples/react/pagination/next-env.d.ts
  95. +3 −0 examples/react/pagination/next.config.js
  96. +7 −4 examples/react/pagination/package.json
  97. +3 −2 examples/react/pagination/src/pages/api/{projects.js → projects.ts}
  98. +10 −6 examples/react/pagination/src/pages/{index.js → index.tsx}
  99. +19 −0 examples/react/pagination/tsconfig.json
  100. +1 −1 examples/react/playground/index.html
  101. +3 −14 examples/react/playground/package.json
  102. +31 −20 examples/react/playground/src/{index.jsx → index.tsx}
  103. +24 −0 examples/react/playground/tsconfig.json
  104. +6 −0 examples/react/playground/vite.config.ts
  105. +0 −6 examples/react/prefetching/libs/fetch.js
  106. +5 −0 examples/react/prefetching/next-env.d.ts
  107. +3 −0 examples/react/prefetching/next.config.js
  108. +7 −4 examples/react/prefetching/package.json
  109. +17 −7 examples/react/prefetching/src/pages/[user]/{[repo].js → [repo].tsx}
  110. +2 −1 examples/react/prefetching/src/pages/{_app.js → _app.tsx}
  111. +0 −26 examples/react/prefetching/src/pages/api/data.js
  112. +8 −7 examples/react/prefetching/src/pages/{index.js → index.tsx}
  113. +19 −0 examples/react/prefetching/tsconfig.json
  114. +2 −2 examples/react/react-native/package.json
  115. +2 −14 examples/react/react-router/package.json
  116. +1 −1 examples/react/rick-morty/index.html
  117. +3 −14 examples/react/rick-morty/package.json
  118. +1 −3 examples/react/{star-wars/src/App.jsx → rick-morty/src/App.tsx}
  119. +3 −4 examples/react/rick-morty/src/{Layout.jsx → Layout.tsx}
  120. +1 −3 examples/react/rick-morty/src/{index.jsx → index.tsx}
  121. +25 −0 examples/react/rick-morty/tsconfig.json
  122. +6 −0 examples/react/rick-morty/vite.config.ts
  123. +7 −8 examples/react/shadow-dom/package.json
  124. +1 −1 examples/react/simple/index.html
  125. +3 −15 examples/react/simple/package.json
  126. +9 −8 examples/react/simple/src/{index.jsx → index.tsx}
  127. +24 −0 examples/react/simple/tsconfig.json
  128. +6 −0 examples/react/simple/vite.config.ts
  129. +1 −1 examples/react/star-wars/index.html
  130. +3 −14 examples/react/star-wars/package.json
  131. +3 −5 examples/react/{rick-morty/src/App.jsx → star-wars/src/App.tsx}
  132. +4 −5 examples/react/star-wars/src/{Layout.jsx → Layout.tsx}
  133. +1 −3 examples/react/star-wars/src/{index.jsx → index.tsx}
  134. +25 −0 examples/react/star-wars/tsconfig.json
  135. +6 −0 examples/react/star-wars/vite.config.ts
  136. +1 −1 examples/react/suspense/index.html
  137. +9 −15 examples/react/suspense/package.json
  138. +8 −2 examples/react/suspense/src/components/{Button.jsx → Button.tsx}
  139. +9 −5 examples/react/suspense/src/components/{Project.jsx → Project.tsx}
  140. +12 −10 examples/react/suspense/src/components/{Projects.jsx → Projects.tsx}
  141. 0 examples/react/suspense/src/components/{Spinner.jsx → Spinner.tsx}
  142. +3 −3 examples/react/suspense/src/{index.jsx → index.tsx}
  143. +0 −25 examples/react/suspense/src/queries.js
  144. +23 −0 examples/react/suspense/src/queries.ts
  145. +24 −0 examples/react/suspense/tsconfig.json
  146. +6 −0 examples/react/suspense/vite.config.ts
  147. +5 −5 examples/solid/astro/package.json
  148. +2 −2 examples/solid/basic-graphql-request/package.json
  149. +17 −11 examples/solid/basic-graphql-request/src/index.tsx
  150. 0 examples/solid/{basic-typescript → basic}/.eslintrc.cjs
  151. 0 examples/solid/{basic-typescript → basic}/.gitignore
  152. 0 examples/solid/{basic-typescript → basic}/README.md
  153. 0 examples/solid/{basic-typescript → basic}/index.html
  154. +3 −3 examples/solid/{basic-typescript → basic}/package.json
  155. BIN examples/solid/{basic-typescript → basic}/src/assets/favicon.ico
  156. +8 −16 examples/solid/{basic-typescript → basic}/src/index.tsx
  157. 0 examples/solid/{basic-typescript → basic}/tsconfig.json
  158. 0 examples/solid/{basic-typescript → basic}/vite.config.ts
  159. +2 −2 examples/solid/default-query-function/package.json
  160. +3 −3 examples/solid/simple/package.json
  161. +3 −6 examples/solid/simple/src/index.tsx
  162. +4 −3 examples/solid/solid-start-streaming/package.json
  163. +2 −2 examples/svelte/auto-refetching/package.json
  164. +2 −2 examples/svelte/basic/package.json
  165. +2 −2 examples/svelte/load-more-infinite-scroll/package.json
  166. +2 −2 examples/svelte/optimistic-updates-typescript/package.json
  167. +2 −2 examples/svelte/playground/package.json
  168. +2 −2 examples/svelte/simple/package.json
  169. +2 −2 examples/svelte/ssr/package.json
  170. +2 −2 examples/svelte/star-wars/package.json
  171. +1 −1 examples/vue/2.6-basic/package.json
  172. +2 −2 examples/vue/2.7-basic/package.json
  173. +2 −2 examples/vue/basic/package.json
  174. +1 −1 examples/vue/dependent-queries/package.json
  175. +1 −1 examples/vue/nuxt3/package.json
  176. +4 −4 examples/vue/persister/package.json
  177. +2 −2 examples/vue/simple/package.json
  178. +1 −1 integrations/angular-cli-standalone-17/package.json
  179. +3 −0 integrations/react-next-15/next.config.js
  180. +2 −3 integrations/react-next-15/package.json
  181. +3 −0 integrations/react-next/next.config.js
  182. +0 −1 integrations/react-next/package.json
  183. +29 −31 nx.json
  184. +3 −4 package.json
  185. +2 −2 packages/angular-query-devtools-experimental/package.json
  186. +4 −4 packages/angular-query-experimental/package.json
  187. +1 −1 packages/eslint-plugin-query/package.json
  188. +1 −1 packages/query-async-storage-persister/package.json
  189. +1 −1 packages/query-broadcast-client-experimental/package.json
  190. +1 −1 packages/query-codemods/package.json
  191. +1 −1 packages/query-core/package.json
  192. +1 −1 packages/query-devtools/package.json
  193. +1 −1 packages/query-persist-client-core/package.json
  194. +1 −1 packages/query-sync-storage-persister/package.json
  195. +1 −1 packages/react-query-devtools/package.json
  196. +1 −1 packages/react-query-next-experimental/package.json
  197. +1 −1 packages/react-query-persist-client/package.json
  198. +1 −1 packages/react-query/package.json
  199. +2 −2 packages/solid-query-devtools/package.json
  200. +5 −4 packages/solid-query-persist-client/package.json
  201. +3 −3 packages/solid-query/package.json
  202. +1 −1 packages/svelte-query-devtools/package.json
  203. +1 −1 packages/svelte-query-persist-client/package.json
  204. +1 −1 packages/svelte-query/package.json
  205. +4 −1 packages/svelte-query/src/createMutation.ts
  206. +3 −5 packages/svelte-query/src/types.ts
  207. +1 −1 packages/vue-query-devtools/package.json
  208. +1 −1 packages/vue-query/package.json
  209. +92 −0 packages/vue-query/src/__tests__/useQueries.test.ts
  210. +84 −0 packages/vue-query/src/__tests__/useQuery.test.ts
  211. +19 −14 packages/vue-query/src/useQueries.ts
  212. +52 −9 packages/vue-query/src/utils.ts
  213. +315 −589 pnpm-lock.yaml
12 changes: 0 additions & 12 deletions .codesandbox/ci.json

This file was deleted.

8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ on:
description: override release tag
required: false
push:
branches: ['main', 'alpha', 'beta', 'rc', 'v4']
branches: [main, alpha, beta, rc, v4]

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
@@ -16,6 +16,10 @@ concurrency:
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

permissions:
contents: write
id-token: write

jobs:
test-and-publish:
name: Test & Publish
@@ -42,7 +46,7 @@ jobs:
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
pnpm run cipublish
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
TAG: ${{ inputs.tag }}
- name: Upload coverage to Codecov
21 changes: 19 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -12,6 +12,9 @@ concurrency:
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

permissions:
contents: read

jobs:
test:
name: Test
@@ -28,8 +31,8 @@ jobs:
- name: Get base and head commits for `nx affected`
uses: nrwl/nx-set-shas@v4
with:
main-branch-name: 'main'
- name: Run Tests
main-branch-name: main
- name: Run Checks
run: pnpm run test:pr --parallel=3
- name: Stop Nx Agents
if: ${{ always() }}
@@ -40,3 +43,17 @@ jobs:
directory: packages
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
preview:
name: Preview
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Tools
uses: tanstack/config/.github/setup@main
- name: Build Packages
run: pnpm run build:all
- name: Publish Previews
run: pnpx pkg-pr-new publish --pnpm --compact './packages/*' --template './examples/*/*'
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
link-workspace-packages=true
prefer-workspace-packages=true
provenance=true
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v22.2.0
22.4.0
2 changes: 1 addition & 1 deletion docs/config.json
Original file line number Diff line number Diff line change
@@ -903,7 +903,7 @@
},
{
"label": "Basic",
"to": "framework/solid/examples/basic-typescript"
"to": "framework/solid/examples/basic"
},
{
"label": "Basic w/ GraphQL-Request",
4 changes: 2 additions & 2 deletions docs/eslint/eslint-plugin-query.md
Original file line number Diff line number Diff line change
@@ -82,5 +82,5 @@ Alternatively, add `@tanstack/eslint-plugin-query` to the plugins section, and c
## Rules

- [@tanstack/query/exhaustive-deps](../exhaustive-deps)
- [@tanstack/query/no-rest-destructuring](../exhaustive-deps)
- [@tanstack/query/stable-query-client](../exhaustive-deps)
- [@tanstack/query/no-rest-destructuring](../no-rest-destructuring)
- [@tanstack/query/stable-query-client](../stable-query-client)
4 changes: 2 additions & 2 deletions docs/framework/react/guides/prefetching.md
Original file line number Diff line number Diff line change
@@ -196,7 +196,7 @@ This starts fetching `'article-comments'` immediately and flattens the waterfall

[//]: # 'Suspense'

If you want to prefetch together with Suspense, you will have to do things a bit differently. You can't use `useSuspenseQueries` to prefetch, since the prefetch would block the component from rendering. You also can not use `useQuery` for the prefetch, because that wouldn't start the prefetch until after suspenseful query had resolved. For this scenario, you can use the [`usePrefetchQuery`](../reference/usePrefetchQuery) or the [`usePrefetchInfiniteQuery`](../reference/usePrefetchInfiniteQuery) hooks available in the library.
If you want to prefetch together with Suspense, you will have to do things a bit differently. You can't use `useSuspenseQueries` to prefetch, since the prefetch would block the component from rendering. You also can not use `useQuery` for the prefetch, because that wouldn't start the prefetch until after suspenseful query had resolved. For this scenario, you can use the [`usePrefetchQuery`](../../reference/usePrefetchQuery) or the [`usePrefetchInfiniteQuery`](../../reference/usePrefetchInfiniteQuery) hooks available in the library.

You can now use `useSuspenseQuery` in the component that actually needs the data. You _might_ want to wrap this later component in its own `<Suspense>` boundary so the "secondary" query we are prefetching does not block rendering of the "primary" data.

@@ -378,7 +378,7 @@ Because data fetching in the component tree itself can easily lead to request wa

In this approach, you explicitly declare for each _route_ what data is going to be needed for that component tree, ahead of time. Because Server Rendering has traditionally needed all data to be loaded before rendering starts, this has been the dominating approach for SSR'd apps for a long time. This is still a common approach and you can read more about it in the [Server Rendering & Hydration guide](../ssr).

For now, let's focus on the client side case and look at an example of how you can make this work with [Tanstack Router](https://tanstack.com/router). These examples leave out a lot of setup and boilerplate to stay concise, you can check out a [full React Query example](https://tanstack.com/router/v1/docs/examples/react/with-react-query?file=src%2Fmain.tsx) over in the [Tanstack Router docs](https://tanstack.com/router/v1/docs).
For now, let's focus on the client side case and look at an example of how you can make this work with [Tanstack Router](https://tanstack.com/router). These examples leave out a lot of setup and boilerplate to stay concise, you can check out a [full React Query example](https://tanstack.com/router/v1/docs/framework/react/examples/basic-react-query-file-based) over in the [Tanstack Router docs](https://tanstack.com/router/v1/docs).

When integrating at the router level, you can choose to either _block_ rendering of that route until all data is present, or you can start a prefetch but not await the result. That way, you can start rendering the route as soon as possible. You can also mix these two approaches and await some critical data, but start rendering before all the secondary data has finished loading. In this example, we'll configure an `/article` route to not render until the article data has finished loading, as well as start prefetching comments as soon as possible, but not block rendering the route if comments haven't finished loading yet.

6 changes: 6 additions & 0 deletions docs/framework/vue/community/community-projects.md
Original file line number Diff line number Diff line change
@@ -12,3 +12,9 @@ There are lots of community projects that build on top of Vue Query and use it t
A library for creating typesafe standardized query keys, useful for cache management in `@tanstack/query`

Link: https://github.com/lukemorales/query-key-factory

## Query Rewind

Time travel and visualize state during development

Link: https://reactqueryrewind.com/
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.10",
"@angular/platform-browser": "^17.3.10",
"@angular/platform-browser-dynamic": "^17.3.10",
"@tanstack/angular-query-experimental": "^5.50.1",
"@tanstack/angular-query-experimental": "^5.51.1",
"rxjs": "^7.8.1",
"tslib": "^2.6.2",
"zone.js": "^0.14.6"
@@ -23,7 +23,7 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.10",
"@tanstack/angular-query-devtools-experimental": "^5.50.1",
"@tanstack/angular-query-devtools-experimental": "^5.51.1",
"typescript": "5.3.3"
}
}
8 changes: 4 additions & 4 deletions examples/angular/infinite-query-with-max-pages/package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"name": "@tanstack/query-example-angular-infinite-query-with-max-pages",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development"
},
"private": true,
"dependencies": {
"@angular/common": "^17.3.10",
"@angular/compiler": "^17.3.10",
"@angular/core": "^17.3.10",
"@angular/platform-browser": "^17.3.10",
"@angular/platform-browser-dynamic": "^17.3.10",
"@tanstack/angular-query-experimental": "^5.50.1",
"@tanstack/angular-query-experimental": "^5.51.1",
"rxjs": "^7.8.1",
"tslib": "^2.6.2",
"zone.js": "^0.14.6"
@@ -23,7 +23,7 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.10",
"@tanstack/angular-query-devtools-experimental": "^5.50.1",
"@tanstack/angular-query-devtools-experimental": "^5.51.1",
"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.10",
"@angular/platform-browser-dynamic": "^17.3.10",
"@angular/router": "^17.3.10",
"@tanstack/angular-query-experimental": "^5.50.1",
"@tanstack/angular-query-experimental": "^5.51.1",
"rxjs": "^7.8.1",
"tslib": "^2.6.2",
"zone.js": "^0.14.6"
@@ -24,7 +24,7 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.10",
"@tanstack/angular-query-devtools-experimental": "^5.50.1",
"@tanstack/angular-query-devtools-experimental": "^5.51.1",
"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.10",
"@angular/platform-browser-dynamic": "^17.3.10",
"@angular/router": "^17.3.10",
"@tanstack/angular-query-experimental": "^5.50.1",
"@tanstack/angular-query-experimental": "^5.51.1",
"rxjs": "^7.8.1",
"tslib": "^2.6.2",
"zone.js": "^0.14.6"
@@ -24,7 +24,7 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.10",
"@tanstack/angular-query-devtools-experimental": "^5.50.1",
"@tanstack/angular-query-devtools-experimental": "^5.51.1",
"typescript": "5.3.3"
}
}
18 changes: 3 additions & 15 deletions examples/react/algolia/package.json
Original file line number Diff line number Diff line change
@@ -11,30 +11,18 @@
"dependencies": {
"@algolia/client-search": "4.23.3",
"@algolia/transporter": "4.23.3",
"@tanstack/react-query": "^5.50.1",
"@tanstack/react-query-devtools": "^5.50.1",
"@tanstack/react-query": "^5.51.1",
"@tanstack/react-query-devtools": "^5.51.1",
"algoliasearch": "4.23.3",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
},
"devDependencies": {
"@tanstack/eslint-plugin-query": "^5.50.1",
"@tanstack/eslint-plugin-query": "^5.51.1",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"@vitejs/plugin-react": "^4.2.1",
"typescript": "5.3.3",
"vite": "^5.2.11"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
5 changes: 5 additions & 0 deletions examples/react/auto-refetching/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
3 changes: 3 additions & 0 deletions examples/react/auto-refetching/next.config.js
Original file line number Diff line number Diff line change
@@ -5,6 +5,9 @@ const nextConfig = {
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: true,
},
}

export default nextConfig
11 changes: 7 additions & 4 deletions examples/react/auto-refetching/package.json
Original file line number Diff line number Diff line change
@@ -8,12 +8,15 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.50.1",
"@tanstack/react-query-devtools": "^5.50.1",
"axios": "^1.6.8",
"isomorphic-unfetch": "4.0.2",
"@tanstack/react-query": "^5.51.1",
"@tanstack/react-query-devtools": "^5.51.1",
"next": "^14.2.4",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"typescript": "5.3.3"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import type { NextApiRequest, NextApiResponse } from 'next'

// an simple endpoint for getting current list
let list = ['Item 1', 'Item 2', 'Item 3']

export default async (req, res) => {
export default async (
req: NextApiRequest,
res: NextApiResponse<typeof list>,
) => {
if (req.query.add) {
if (!list.includes(req.query.add)) {
list.push(req.query.add)
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import React from 'react'
import axios from 'axios'

//

import {
useQuery,
useQueryClient,
useMutation,
QueryClient,
QueryClientProvider,
useMutation,
useQuery,
useQueryClient,
} from '@tanstack/react-query'
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'

@@ -29,16 +26,16 @@ function Example() {

const { status, data, error, isFetching } = useQuery({
queryKey: ['todos'],
queryFn: async () => {
const res = await axios.get('/api/data')
return res.data
queryFn: async (): Promise<Array<string>> => {
const response = await fetch('/api/data')
return await response.json()
},
// Refetch the data every second
refetchInterval: intervalMs,
})

const addMutation = useMutation({
mutationFn: (add) => fetch(`/api/data?add=${add}`),
mutationFn: (add: string) => fetch(`/api/data?add=${add}`),
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
})

@@ -52,7 +49,7 @@ function Example() {

return (
<div>
<h1>Auto Refetch with stale-time set to 1s)</h1>
<h1>Auto Refetch with stale-time set to {intervalMs}ms</h1>
<p>
This example is best experienced on your own machine, where you can open
multiple tabs to the same localhost server and see your changes
19 changes: 19 additions & 0 deletions examples/react/auto-refetching/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
3 changes: 0 additions & 3 deletions examples/react/basic-graphql-request/.eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion examples/react/basic-graphql-request/index.html
Original file line number Diff line number Diff line change
@@ -11,6 +11,6 @@
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.jsx"></script>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
Loading