diff --git a/.babelrc b/.babelrc
deleted file mode 100644
index 9ee1494a0ce..00000000000
--- a/.babelrc
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "presets": [
- [
- "@babel/env",
- {
- "modules": false,
- "exclude": ["@babel/plugin-transform-regenerator"]
- }
- ],
- "@babel/react"
- ],
- "plugins": [
- [
- "module:fast-async",
- {
- "compiler": {
- "noRuntime": true
- }
- }
- ]
- ],
- "env": {
- "test": {
- "presets": [
- [
- "@babel/env",
- {
- "modules": "commonjs",
- "exclude": ["@babel/plugin-transform-regenerator"]
- }
- ]
- ]
- }
- }
-}
diff --git a/.changeset/config.json b/.changeset/config.json
new file mode 100644
index 00000000000..d3af6f132a4
--- /dev/null
+++ b/.changeset/config.json
@@ -0,0 +1,17 @@
+{
+ "$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json",
+ "changelog": [
+ "@svitejs/changesets-changelog-github-compact",
+ { "repo": "TanStack/query" }
+ ],
+ "commit": false,
+ "access": "public",
+ "baseBranch": "main",
+ "updateInternalDependencies": "patch",
+ "fixed": [],
+ "linked": [],
+ "ignore": [],
+ "___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
+ "onlyUpdatePeerDependentsWhenOutOfRange": true
+ }
+}
diff --git a/.eslintrc b/.eslintrc
deleted file mode 100644
index 05544ddde0d..00000000000
--- a/.eslintrc
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "parser": "babel-eslint",
- "extends": ["react-app", "prettier"],
- "env": {
- "es6": true
- },
- "parserOptions": {
- "sourceType": "module"
- }
-}
diff --git a/.gitattributes b/.gitattributes
index dfe0770424b..5a0d5e480b5 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,2 +1,2 @@
# Auto detect text files and perform LF normalization
-* text=auto
+* text=auto eol=lf
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 508727c1220..b4b20dcf80a 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,2 +1 @@
-github: tannerlinsley
-custom: https://youtube.com/tannerlinsley
+github: [tannerlinsley, tkdodo]
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
new file mode 100644
index 00000000000..585b6f1c05d
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -0,0 +1,133 @@
+name: '🐛 Bug report'
+description: Report a reproducible bug or regression
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Thank you for reporting an issue :pray:.
+
+ This issue tracker is for reporting reproducible bugs or regression's found in [TanStack Query](https://github.com/TanStack/query)
+ If you have a question about how to achieve something and are struggling, please post a question
+ inside of TanStack Query's [Discussions tab](https://github.com/TanStack/query/discussions)
+
+ Before submitting a new bug/issue, please check the links below to see if there is a solution or question posted there already:
+ - TanStack Query's [Discussions tab](https://github.com/TanStack/query/discussions)
+ - TanStack Query's [Open Issues](https://github.com/TanStack/query/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc)
+ - TanStack Query's [Closed Issues](https://github.com/TanStack/query/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed)
+
+ The more information you fill in, the better the community can help you.
+ - type: textarea
+ id: description
+ attributes:
+ label: Describe the bug
+ description: Provide a clear and concise description of the challenge you are running into.
+ validations:
+ required: true
+ - type: input
+ id: link
+ attributes:
+ label: Your minimal, reproducible example
+ description: |
+ Please add a link to a minimal reproduction.
+ Note:
+ - Your bug may get fixed much faster if we can run your code and it doesn't have dependencies other than React/Solid/Vue/Svelte.
+ - To create a shareable code example for web, you can use CodeSandbox (https://codesandbox.io/s/new) or Stackblitz (https://stackblitz.com/).
+ - Please make sure the example is complete and runnable - e.g. avoid localhost URLs.
+ - To stub out real api requests - Promise.resolve and Promise.reject are good options for easy reproduction
+ - Feel free to fork any of the official examples to reproduce your issue: https://tanstack.com/query/latest/docs/framework/react/examples/simple
+ - For React Native, you can use: https://snack.expo.dev/
+ - For TypeScript related issues only, a TypeScript Playground link might be sufficient: https://www.typescriptlang.org/play
+ - Please read these tips for providing a minimal example: https://stackoverflow.com/help/mcve.
+ placeholder: |
+ e.g. Code Sandbox, Stackblitz, Expo Snack or TypeScript playground
+ validations:
+ required: true
+ - type: textarea
+ id: steps
+ attributes:
+ label: Steps to reproduce
+ description: Describe the steps we have to take to reproduce the behavior.
+ placeholder: |
+ 1. Go to '...'
+ 2. Click on '....'
+ 3. Scroll down to '....'
+ 4. See error
+ validations:
+ required: true
+ - type: textarea
+ id: expected
+ attributes:
+ label: Expected behavior
+ description: Provide a clear and concise description of what you expected to happen.
+ placeholder: |
+ As a user, I expected ___ behavior but i am seeing ___
+ validations:
+ required: true
+ - type: dropdown
+ attributes:
+ label: How often does this bug happen?
+ description: |
+ Following the repro steps above, how easily are you able to reproduce this bug?
+ options:
+ - Every time
+ - Often
+ - Sometimes
+ - Only once
+ - type: textarea
+ id: screenshots_or_videos
+ attributes:
+ label: Screenshots or Videos
+ description: |
+ If applicable, add screenshots or a video to help explain your problem.
+ For more information on the supported file image/file types and the file size limits, please refer
+ to the following link: https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/attaching-files
+ placeholder: |
+ You can drag your video or image files inside of this editor ↓
+ - type: textarea
+ id: platform
+ attributes:
+ label: Platform
+ description: |
+ Please let us know which Operting System, Browser and Browser version you were using when the issue occurred.
+ placeholder: |
+ - OS: [e.g. macOS, Windows, Linux, iOS, Android]
+ - Browser: [e.g. Chrome, Safari, Firefox, React Native]
+ - Version: [e.g. 91.1]
+ validations:
+ required: true
+ - type: dropdown
+ id: adapter
+ attributes:
+ label: Tanstack Query adapter
+ description: |
+ Please let us know which adapter of TanStack Query you were using when the issue occurred.
+ options:
+ - react-query
+ - solid-query
+ - svelte-query
+ - vue-query
+ - angular-query
+ - vanilla
+ - type: input
+ id: rq-version
+ attributes:
+ label: TanStack Query version
+ description: |
+ Please let us know the exact version of TanStack Query you were using when the issue occurred. Please don't just put in "latest", as this is subject to change.
+ placeholder: |
+ e.g. v5.51.9
+ validations:
+ required: true
+ - type: input
+ id: ts-version
+ attributes:
+ label: TypeScript version
+ description: |
+ If you are using TypeScript, please let us know the exact version of TypeScript you were using when the issue occurred.
+ placeholder: |
+ e.g. v5.5.4
+ - type: textarea
+ id: additional
+ attributes:
+ label: Additional context
+ description: Add any other context about the problem here.
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 00000000000..f3372a89ce3
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,11 @@
+blank_issues_enabled: false
+contact_links:
+ - name: 🤔 Feature Requests & Questions
+ url: https://github.com/TanStack/query/discussions
+ about: Please ask and answer questions here.
+ - name: 💬 Community Chat
+ url: https://discord.gg/mQd7egN
+ about: A dedicated discord server hosted by TanStack
+ - name: 🦋 TanStack Bluesky
+ url: https://bsky.app/profile/tanstack.com
+ about: Stay up to date with new releases of our libraries
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
new file mode 100644
index 00000000000..5d397ac0a28
--- /dev/null
+++ b/.github/pull_request_template.md
@@ -0,0 +1,13 @@
+## 🎯 Changes
+
+
+
+## ✅ Checklist
+
+- [ ] I have followed the steps in the [Contributing guide](https://github.com/TanStack/query/blob/main/CONTRIBUTING.md).
+- [ ] I have tested this code locally with `pnpm run test:pr`.
+
+## 🚀 Release Impact
+
+- [ ] This change affects published code, and I have generated a [changeset](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md).
+- [ ] This change is docs/CI/dev-only (no release).
diff --git a/.github/renovate.json b/.github/renovate.json
new file mode 100644
index 00000000000..6bcdc1b4279
--- /dev/null
+++ b/.github/renovate.json
@@ -0,0 +1,42 @@
+{
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
+ "configMigration": true,
+ "extends": [
+ "config:recommended",
+ "group:allNonMajor",
+ "schedule:weekly",
+ ":approveMajorUpdates",
+ ":automergeMinor",
+ ":disablePeerDependencies",
+ ":maintainLockFilesMonthly",
+ ":semanticCommits",
+ ":semanticCommitTypeAll(chore)"
+ ],
+ "ignorePresets": [":ignoreModulesAndTests"],
+ "labels": ["dependencies"],
+ "rangeStrategy": "bump",
+ "postUpdateOptions": ["pnpmDedupe"],
+ "ignoreDeps": [
+ "@types/node",
+ "@types/react",
+ "@types/react-dom",
+ "node",
+ "react",
+ "react-dom",
+ "tsup",
+ "typescript",
+ "typescript50",
+ "typescript51",
+ "typescript52",
+ "typescript53",
+ "typescript54",
+ "typescript55",
+ "typescript56",
+ "typescript57",
+ "vue",
+ "vue-tsc",
+ "vue2",
+ "vue2.7",
+ "webpack"
+ ]
+}
diff --git a/.github/size-plugin.yml b/.github/size-plugin.yml
deleted file mode 100644
index de418983a71..00000000000
--- a/.github/size-plugin.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-size-files:
- - sizes-cjs.json
- - sizes-es.json
diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml
new file mode 100644
index 00000000000..8ee586fd6b6
--- /dev/null
+++ b/.github/workflows/autofix.yml
@@ -0,0 +1,31 @@
+name: autofix.ci # needed to securely identify the workflow
+
+on:
+ pull_request:
+ push:
+ branches: [main, alpha, beta, rc, v4]
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
+ cancel-in-progress: true
+
+permissions:
+ contents: read
+
+jobs:
+ autofix:
+ name: autofix
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v6.0.1
+ with:
+ fetch-depth: 0
+ - name: Setup Tools
+ uses: tanstack/config/.github/setup@main
+ - name: Fix formatting
+ run: pnpm run format
+ - name: Apply fixes
+ uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27
+ with:
+ commit-message: 'ci: apply automated fixes'
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
new file mode 100644
index 00000000000..918ee80661e
--- /dev/null
+++ b/.github/workflows/labeler.yml
@@ -0,0 +1,17 @@
+name: Labeler
+
+on:
+ - pull_request_target
+
+permissions:
+ contents: read
+ pull-requests: write
+
+jobs:
+ labeler:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/labeler@v5.0.0
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+ configuration-path: labeler-config.yml
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
new file mode 100644
index 00000000000..453400b546a
--- /dev/null
+++ b/.github/workflows/pr.yml
@@ -0,0 +1,74 @@
+name: PR
+
+on:
+ pull_request:
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
+ cancel-in-progress: true
+
+env:
+ NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
+
+permissions:
+ contents: read
+ pull-requests: write
+
+jobs:
+ test:
+ name: Test
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v6.0.1
+ with:
+ fetch-depth: 0
+ - name: Start Nx Agents
+ run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml"
+ - name: Setup Tools
+ uses: tanstack/config/.github/setup@main
+ - name: Get base and head commits for `nx affected`
+ uses: nrwl/nx-set-shas@v4.4.0
+ with:
+ main-branch-name: main
+ - name: Run Checks
+ run: pnpm run test:pr
+ - name: Stop Nx Agents
+ if: ${{ always() }}
+ run: npx nx-cloud stop-all-agents
+ preview:
+ name: Preview
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v6.0.1
+ 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/*/*'
+ - name: Determine commit SHA
+ id: determine-sha
+ run: |
+ echo "COMMIT_SHA=${{ github.event.pull_request.head.sha || github.sha }}" >> $GITHUB_ENV
+ - name: Size Limit
+ uses: andresz1/size-limit-action@94bc357df29c36c8f8d50ea497c3e225c3c95d1d
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ skip_step: install
+ build_script: build:all
+ provenance:
+ name: Provenance
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v6.0.1
+ with:
+ fetch-depth: 0
+ - name: Check Provenance
+ uses: danielroe/provenance-action@v0.1.1
+ with:
+ fail-on-downgrade: true
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 00000000000..39223466e61
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,74 @@
+name: Release
+
+on:
+ push:
+ branches: [main, alpha, beta, rc, v4]
+ repository_dispatch:
+ types: [release]
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
+ cancel-in-progress: true
+
+env:
+ NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
+
+permissions:
+ contents: write
+ id-token: write
+ pull-requests: write
+
+jobs:
+ release:
+ name: Release
+ if: github.repository_owner == 'TanStack'
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v6.0.1
+ with:
+ fetch-depth: 0
+ - name: Start Nx Agents
+ run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml"
+ - name: Setup Tools
+ uses: tanstack/config/.github/setup@main
+ - name: Run Tests
+ run: pnpm run test:ci
+ - name: Stop Nx Agents
+ if: ${{ always() }}
+ run: npx nx-cloud stop-all-agents
+ # - name: Check for Changesets marked as major
+ # id: major
+ # run: |
+ # echo "found=false" >> $GITHUB_OUTPUT
+ # regex="(major)"
+ # shopt -s nullglob
+ # for file in .changeset/*.md; do
+ # if [[ $(cat $file) =~ $regex ]]; then
+ # echo "found=true" >> $GITHUB_OUTPUT
+ # fi
+ # done
+ - name: Run Changesets (version or publish)
+ id: changesets
+ uses: changesets/action@v1.5.3
+ with:
+ version: pnpm run changeset:version
+ publish: pnpm run changeset:publish
+ commit: 'ci: Version Packages'
+ title: 'ci: Version Packages'
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ # - name: Auto-merge Changesets PR
+ # if: steps.changesets.outputs.hasChangesets == 'true' && steps.major.outputs.found == 'false'
+ # run: |
+ # gh pr merge --squash "$PR_NUMBER"
+ # gh api --method POST /repos/$REPO/dispatches -f 'event_type=release'
+ # env:
+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ # REPO: ${{ github.repository }}
+ # PR_NUMBER: ${{ steps.changesets.outputs.pullRequestNumber }}
+ - name: Comment on PRs about release
+ if: steps.changesets.outputs.published == 'true'
+ uses: tanstack/config/.github/comment-on-release@main
+ with:
+ published-packages: ${{ steps.changesets.outputs.publishedPackages }}
diff --git a/.gitignore b/.gitignore
index b98237d1fee..6e71fdf278c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,12 +3,14 @@
# dependencies
node_modules
+package-lock.json
+yarn.lock
# builds
build
+coverage
dist
-artifacts
-.rpt2_cache
+dist-ts
# misc
.DS_Store
@@ -18,8 +20,33 @@ artifacts
.env.test.local
.env.production.local
.next
+next-env.d.ts
npm-debug.log*
yarn-debug.log*
yarn-error.log*
-.history
\ No newline at end of file
+.history
+size-plugin.json
+stats-hydration.json
+stats.json
+stats.html
+.vscode/settings.json
+.vscode/mcp.json
+.cursor/rules
+.github/instructions/nx.instructions.md
+
+*.log
+*.tsbuildinfo
+.angular
+.cache
+.idea
+.nx/cache
+.nx/workspace-data
+.pnpm-store
+.svelte-kit
+.tsup
+.vinxi
+temp
+
+vite.config.js.timestamp-*
+vite.config.ts.timestamp-*
diff --git a/.npmrc b/.npmrc
new file mode 100644
index 00000000000..268c392d3cb
--- /dev/null
+++ b/.npmrc
@@ -0,0 +1 @@
+provenance=true
diff --git a/.nvmrc b/.nvmrc
new file mode 100644
index 00000000000..b4040276043
--- /dev/null
+++ b/.nvmrc
@@ -0,0 +1 @@
+24.8.0
diff --git a/.nx/workflows/dynamic-changesets.yaml b/.nx/workflows/dynamic-changesets.yaml
new file mode 100644
index 00000000000..8458c190607
--- /dev/null
+++ b/.nx/workflows/dynamic-changesets.yaml
@@ -0,0 +1,4 @@
+distribute-on:
+ small-changeset: 3 linux-medium-js
+ medium-changeset: 4 linux-medium-js
+ large-changeset: 5 linux-medium-js
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 00000000000..d1bb5343b0b
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,12 @@
+**/.next
+**/.nx/cache
+**/.svelte-kit
+**/build
+**/coverage
+**/dist
+**/query-codemods/**/__testfixtures__
+.changeset/*.md
+pnpm-lock.yaml
+packages/**/tsup.config.bundled*.mjs
+**/tsconfig.vitest-temp.json
+docs/framework/*/reference
diff --git a/.size-limit.json b/.size-limit.json
new file mode 100644
index 00000000000..4ec421f4d52
--- /dev/null
+++ b/.size-limit.json
@@ -0,0 +1,15 @@
+[
+ {
+ "name": "react full",
+ "path": "packages/react-query/build/modern/index.js",
+ "limit": "13.00 kB",
+ "ignore": ["react", "react-dom"]
+ },
+ {
+ "name": "react minimal",
+ "path": "packages/react-query/build/modern/index.js",
+ "limit": "9.99 kB",
+ "import": "{ useQuery, QueryClient, QueryClientProvider }",
+ "ignore": ["react", "react-dom"]
+ }
+]
diff --git a/.size-snapshot.json b/.size-snapshot.json
deleted file mode 100644
index add318f27b1..00000000000
--- a/.size-snapshot.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "dist/index.js": {
- "bundled": 29796,
- "minified": 14847,
- "gzipped": 4213
- },
- "dist/index.es.js": {
- "bundled": 29276,
- "minified": 14383,
- "gzipped": 4111,
- "treeshaked": {
- "rollup": {
- "code": 3472,
- "import_statements": 21
- },
- "webpack": {
- "code": 4493
- }
- }
- }
-}
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 5ae48949ffa..00000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-language: node_js
-node_js:
- - 10
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index 03667474979..00000000000
--- a/CHANGELOG.md
+++ /dev/null
@@ -1,110 +0,0 @@
-# Changelog
-
-## 0.3.24
-
-- Fixed an issue where isDocumentVisible wasn't properly guarded against in all non-web scenarios
-- Fixed an issue where query cancellation functions may not have been called
-- Added the new `setFocusHandler` utility which allows the overriding of the event that triggers window focusing
-- Updated the docs to show how to use `setFocusHandler` to avoid iframe events from triggerig window focus
-
-## 0.3.23
-
-- Fixed an issue where queries would not refresh in the background when using suspense
-
-## 0.3.22
-
-- Caching is now disabled when React Query is used on the server. It is still possible to seed queries using `initialData` during SSR.
-
-## 0.3.21
-
-- Fixed an edge case where `useIsLoading` would not update or rerender correctly.
-
-## 0.3.20
-
-- Added `config.refetchIntervalInBackground` option
-
-## 0.3.19
-
-- Added `config.initialData` option for SSR
-
-## 0.3.18
-
-- Fix and issue where `setQueryData` would crash when the query does not exist
-
-## 0.3.17
-
-- Fix and issue where queries would double fetch when using suspense
-
-## 0.3.16
-
-- Remove nodent runtime from react-async (shaved off 938 bytes!)
-
-## 0.3.15
-
-- Better esm bundle configuration
-
-## 0.3.14
-
-- Add `promise.cancel` support to query promises to support request cancellation APIs
-- Refetch all on window focus should no longer raise unhandled promise rejections
-
-## 0.3.13
-
-- Fix issue where `document` was not guarded againts in React Native
-
-## 0.3.12
-
-- Remove orphaned npm dependencies
-
-## 0.3.11
-
-- Add `@types/react-query` as a dependency for typescript users
-
-## 0.3.10
-
-- Fix issue where window focus event would try and register in react-native
-
-## 0.3.9
-
-- Fix issue where variable hashes could contain arrays or similar number/string pairs
-- Fix issue where clearing query cache could lead to out of date query states
-
-## 0.3.8
-
-- Internal cleanup and refactoring
-
-## 0.3.7
-
-- Added the `clearQueryCache` API function to clear the query cache
-
-## 0.3.6
-
-- Fixed an issue where passing `config` to `ReactQueryConfigProvider` would not update the non-hook `defaultContext`
-
-## 0.3.5
-
-- Fixed an issue where `isLoading` would remain `true` if a query encountered an error after all retries
-- Fixed regression where `useIsFetching` stopped working
-
-## 0.3.4
-
-- Fixed an issue where `useMutation().mutate` would not throw an error when failing
-
-## 0.3.3
-
-- Fixed an issue where falsey query keys would sometimes still fetch
-
-## 0.3.2
-
-- Added the `useQuery.onSuccess` callback option
-- Added the `useQuery.onError` callback option
-
-## 0.3.1
-
-- Added the `prefetchQuery` method
-- Improved support for Suspense including fetch-as-you-render patterns
-- Undocumented `_useQueries` hook has been removed
-
-## 0.3.0
-
-- The `useReactQueryConfig` hook is now a provider component called `ReactQueryConfigProvider`
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 00000000000..46ed81cdf2b
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,203 @@
+# Contributing
+
+## Questions
+
+If you have questions about implementation details, help or support, then please use our dedicated community forum at [GitHub Discussions](https://github.com/TanStack/query/discussions) **PLEASE NOTE:** If you choose to instead open an issue for your question, your issue will be immediately closed and redirected to the forum.
+
+## Reporting Issues
+
+If you have found what you think is a bug, please [file an issue](https://github.com/TanStack/query/issues/new/choose). **PLEASE NOTE:** Issues that are identified as implementation questions or non-issues will be immediately closed and redirected to [GitHub Discussions](https://github.com/TanStack/query/discussions)
+
+## Suggesting new features
+
+If you are here to suggest a feature, first create an issue if it does not already exist. From there, we will discuss use-cases for the feature and then finally discuss how it could be implemented.
+
+## Development
+
+_TanStack/query uses **symlink-based** configuration files. For smooth development in a local environment, we recommend developing in an environment that supports symlinks(ex: Linux, macOS, Windows Subsystem for Linux / WSL)._
+
+If you have been assigned to fix an issue or develop a new feature, please follow these steps to get started:
+
+- Fork this repository.
+- Install dependencies
+
+ ```bash
+ pnpm install
+ ```
+
+ - We use [pnpm](https://pnpm.io/) v10 for package management (run in case of pnpm-related issues).
+
+ ```bash
+ corepack enable && corepack prepare
+ ```
+
+ - We use [nvm](https://github.com/nvm-sh/nvm) to manage node versions - please make sure to use the version mentioned in `.nvmrc`
+
+ ```bash
+ nvm use
+ ```
+
+- Build all packages.
+
+ ```bash
+ pnpm build:all
+ ```
+
+- Run development server.
+
+ ```bash
+ pnpm run watch
+ ```
+
+- Implement your changes and tests to files in the `src/` directory and corresponding test files.
+- Document your changes in the appropriate doc page.
+- Git stage your required changes and commit (see below commit guidelines).
+- Submit PR for review.
+
+### Editing the docs locally and previewing the changes
+
+The documentations for all the TanStack projects are hosted on [tanstack.com](https://tanstack.com), which is a TanStack Start application (https://github.com/TanStack/tanstack.com). You need to run this app locally to preview your changes in the `TanStack/query` docs.
+
+> [!NOTE]
+> The website fetches the doc pages from GitHub in production, and searches for them at `../query/docs` in development. Your local clone of `TanStack/query` needs to be in the same directory as the local clone of `TanStack/tanstack.com`.
+
+You can follow these steps to set up the docs for local development:
+
+1. Make a new directory called `tanstack`.
+
+```sh
+mkdir tanstack
+```
+
+2. Enter that directory and clone the [`TanStack/query`](https://github.com/TanStack/query) and [`TanStack/tanstack.com`](https://github.com/TanStack/tanstack.com) repos.
+
+```sh
+cd tanstack
+git clone git@github.com:TanStack/query.git
+# We probably don't need all the branches and commit history
+# from the `tanstack.com` repo, so let's just create a shallow
+# clone of the latest version of the `main` branch.
+# Read more about shallow clones here:
+# https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/#user-content-shallow-clones
+git clone git@github.com:TanStack/tanstack.com.git --depth=1 --single-branch --branch=main
+```
+
+> [!NOTE]
+> Your `tanstack` directory should look like this:
+>
+> ```
+> tanstack/
+> |
+> +-- query/ (<-- this directory cannot be called anything else!)
+> |
+> +-- tanstack.com/
+> ```
+
+3. Enter the `tanstack/tanstack.com` directory, install the dependencies and run the app in dev mode:
+
+```sh
+cd tanstack.com
+pnpm i
+# The app will run on https://localhost:3000 by default
+pnpm dev
+```
+
+4. Now you can visit http://localhost:3000/query/latest/docs/framework/react/overview in the browser and see the changes you make in `tanstack/query/docs` there.
+
+> [!WARNING]
+> You will need to update the `docs/config.json` file (in `TanStack/query`) if you add a new documentation page!
+
+You can see the whole process in the screen capture below:
+
+https://github.com/fulopkovacs/form/assets/43729152/9d35a3c3-8153-4e74-9cb2-af275f7a269b
+
+### Running examples
+
+- Make sure you've installed the dependencies in the repo's root directory.
+
+ ```bash
+ pnpm install
+ ```
+
+- If you want to run the example against your local changes, run below in the repo's root directory. Otherwise, it will be run against the latest TanStack Query release.
+
+ ```bash
+ pnpm run watch
+ ```
+
+- Run below in the selected examples' directory.
+
+ ```bash
+ pnpm run dev
+ ```
+
+#### Note on standalone execution
+
+If you want to run an example without installing dependencies for the whole repo, just follow the instructions from the example's README.md file. It will then be run against the latest TanStack Query release.
+
+## Online one-click setup
+
+You can use Gitpod (An Online open-source VS Code-like IDE that is free for Open Source) for developing online. With a single click it will start a workspace and automatically:
+
+- clone the `TanStack/query` repo.
+- install all the dependencies in `/` and `/docs`.
+- run below in the root(`/`) to Auto-build files.
+
+ ```bash
+ npm start
+ ```
+
+- run below in `/docs`.
+
+ ```bash
+ npm run dev
+ ```
+
+[](https://gitpod.io/#https://github.com/TanStack/query)
+
+## Changesets
+
+This repo uses [Changesets](https://github.com/changesets/changesets) to automate releases. If your PR should release a new package version (patch, minor, or major), please run `pnpm changeset` and commit the file. If needed, changeset descriptions can be more descriptive, and will be included in the changelog. If your PR affects docs, examples, styles, etc., you probably don't need to generate a changeset.
+
+## Pull requests
+
+Maintainers merge pull requests by squashing all commits and editing the commit message if necessary using the GitHub user interface.
+
+Use an appropriate commit type. Be especially careful with breaking changes.
+
+## Releases
+
+For each new commit added to `main`, a GitHub Workflow is triggered which runs the [Changesets Action](https://github.com/changesets/action). This generates a preview PR showing the impact of all changesets. When this PR is merged, the package will be published to NPM.
+
+## 🧪 Test
+
+TanStack Query uses [Nx](https://nx.dev/) as its monorepo tool.
+To run tests in a local environment, you should use `nx` commands from the root directory.
+
+### ✅ Run all tests
+
+To run tests for **all packages**, run:
+
+```bash
+npm run test
+```
+
+### ✅ Run tests for a specific package
+
+To run tests for a specific package, use the following command:
+
+```bash
+npx nx run @tanstack/{package-name}:test:lib
+```
+
+For example:
+
+```bash
+npx nx run @tanstack/react-query:test:lib
+```
+
+### ⚠️ Caution
+
+Do not run `pnpm run test:lib` inside individual package folders.
+This can cause test failures due to dependencies between packages.
+Always run tests from the **root folder** using `nx` commands.
diff --git a/FUNDING.json b/FUNDING.json
new file mode 100644
index 00000000000..39f0477d0d1
--- /dev/null
+++ b/FUNDING.json
@@ -0,0 +1,7 @@
+{
+ "drips": {
+ "ethereum": {
+ "ownedBy": "0xD5371B61b35E13F2ae354BE95081aD63FB383452"
+ }
+ }
+}
diff --git a/LICENSE b/LICENSE
index ebd63781fc4..1869e21fc3c 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2019 Tanner Linsley
+Copyright (c) 2021-present Tanner Linsley
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index 02bf3e8dce5..f21aeb51217 100644
--- a/README.md
+++ b/README.md
@@ -1,1582 +1,105 @@
-
+
-
+
+
-
-
-
- |
- - - Become a Sponsor! - - | -
|
+
+ |
+
+
+ |
+
-
-
-
- |
- - - Become a Sponsor! - - | -
-
-
-
- |
- - - Become a Sponsor! - - | -
-
-
-
- |
- - - Become a Sponsor! - - | -
-
-
-
- |
-
-
|
- - - Become a Supporter! - - | -
-
-
-
- |
-
- - - Become a Fan! - - | -
Loading...
- ) : pages ? ( - <> - {pages.map((page, i) => ( -{project.name}
- ))} -+We're looking for TanStack Query Partners to join our mission! Partner with us to push the boundaries of TanStack Query and build amazing things together. +
+LET'S CHAT +Loading...
+ } @else if (query.isError()) { + Error: {{ query?.error().message }} + } @else { + @for (page of query?.data().pages; track $index) { + @for (project of page.data; track project.id) { +{{ project.name }} {{ project.id }}
+ } + } ++ In this example, each page of data remains visible as the next page is + fetched. The buttons and capability to proceed to the next page are also + suppressed until the next page cursor is known. Each page is cached as a + normal query too, so when going to previous pages, you'll see them + instantaneously while they are also re-fetched invisibly in the + background. +
+ @if (query.status() === 'pending') { +{{ project.name }}
+ } +{{ data.description }}
+ 👀 {{ data.subscribers_count }} + ✨ {{ data.stargazers_count }} + 🍴 {{ data.forks_count }} + } + `, +}) +export class SimpleExampleComponent { + http = inject(HttpClient) + + query = injectQuery(() => ({ + queryKey: ['repoData'], + queryFn: () => + lastValueFrom( + this.http.getLoading...
+ ) : status === 'error' ? ( +Error: {error.message}
+ ) : ( + <> + {data.pages.map((group, i) => ( +{project.name}
+ ))} +{project.name}
+ ))} +