From 865095ddfe0b0c7ed1374bbe9fe2928edeca5767 Mon Sep 17 00:00:00 2001 From: Kaung Zin Hein <83657429+Zen-cronic@users.noreply.github.com> Date: Wed, 24 Sep 2025 07:33:08 -0400 Subject: [PATCH 01/39] fix(solid-query): export `queryOptions` without type errors (#9668) * fix(solid-query): add missing generic error type * refactor(solid-query): remove unused generic type * test(solid-query): add case for error tag --------- Co-authored-by: Dominik Dorfmeister --- .../src/__tests__/queryOptions.test-d.tsx | 15 ++++++++++++++- packages/solid-query/src/queryOptions.ts | 14 ++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/packages/solid-query/src/__tests__/queryOptions.test-d.tsx b/packages/solid-query/src/__tests__/queryOptions.test-d.tsx index 6fb6a7c5f2..2ba3a3f6b2 100644 --- a/packages/solid-query/src/__tests__/queryOptions.test-d.tsx +++ b/packages/solid-query/src/__tests__/queryOptions.test-d.tsx @@ -1,5 +1,10 @@ import { assertType, describe, expectTypeOf, it } from 'vitest' -import { QueryClient, dataTagSymbol, skipToken } from '@tanstack/query-core' +import { + QueryClient, + dataTagErrorSymbol, + dataTagSymbol, + skipToken, +} from '@tanstack/query-core' import { useQuery } from '../useQuery' import { queryOptions } from '../queryOptions' @@ -74,6 +79,14 @@ describe('queryOptions', () => { expectTypeOf(queryKey[dataTagSymbol]).toEqualTypeOf() }) + it('should tag the queryKey with the default error type', () => { + const { queryKey } = queryOptions({ + queryKey: ['key'], + queryFn: () => Promise.resolve(1), + }) + + expectTypeOf(queryKey[dataTagErrorSymbol]).toEqualTypeOf() + }) it('should return the proper type when passed to getQueryData', () => { const { queryKey } = queryOptions({ queryKey: ['key'], diff --git a/packages/solid-query/src/queryOptions.ts b/packages/solid-query/src/queryOptions.ts index 06ee764f9d..04bd2b9c80 100644 --- a/packages/solid-query/src/queryOptions.ts +++ b/packages/solid-query/src/queryOptions.ts @@ -29,11 +29,6 @@ export function queryOptions< TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, - TOptions extends ReturnType< - UndefinedInitialDataOptions - > = ReturnType< - UndefinedInitialDataOptions - >, >( options: ReturnType< UndefinedInitialDataOptions @@ -41,7 +36,7 @@ export function queryOptions< ): ReturnType< UndefinedInitialDataOptions > & { - queryKey: DataTag + queryKey: DataTag } export function queryOptions< @@ -49,11 +44,6 @@ export function queryOptions< TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, - TOptions extends ReturnType< - DefinedInitialDataOptions - > = ReturnType< - DefinedInitialDataOptions - >, >( options: ReturnType< DefinedInitialDataOptions @@ -61,7 +51,7 @@ export function queryOptions< ): ReturnType< DefinedInitialDataOptions > & { - queryKey: DataTag + queryKey: DataTag } export function queryOptions(options: unknown) { From 4d8da1e29e97ad5b0c151822d4962849515b4478 Mon Sep 17 00:00:00 2001 From: Tanner Linsley Date: Wed, 24 Sep 2025 11:40:30 +0000 Subject: [PATCH 02/39] release: v5.90.3 --- examples/solid/astro/package.json | 4 ++-- examples/solid/basic-graphql-request/package.json | 4 ++-- examples/solid/basic/package.json | 4 ++-- examples/solid/default-query-function/package.json | 4 ++-- examples/solid/simple/package.json | 4 ++-- examples/solid/solid-start-streaming/package.json | 4 ++-- packages/solid-query-devtools/package.json | 2 +- packages/solid-query-persist-client/package.json | 2 +- packages/solid-query/package.json | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/examples/solid/astro/package.json b/examples/solid/astro/package.json index 4d74687386..fa39924139 100644 --- a/examples/solid/astro/package.json +++ b/examples/solid/astro/package.json @@ -15,8 +15,8 @@ "@astrojs/solid-js": "^5.0.7", "@astrojs/tailwind": "^6.0.2", "@astrojs/vercel": "^8.1.3", - "@tanstack/solid-query": "^5.90.2", - "@tanstack/solid-query-devtools": "^5.90.2", + "@tanstack/solid-query": "^5.90.3", + "@tanstack/solid-query-devtools": "^5.90.3", "astro": "^5.5.6", "solid-js": "^1.9.7", "tailwindcss": "^3.4.7", diff --git a/examples/solid/basic-graphql-request/package.json b/examples/solid/basic-graphql-request/package.json index bff806503b..9ee0a9c42f 100644 --- a/examples/solid/basic-graphql-request/package.json +++ b/examples/solid/basic-graphql-request/package.json @@ -8,8 +8,8 @@ "preview": "vite preview" }, "dependencies": { - "@tanstack/solid-query": "^5.90.2", - "@tanstack/solid-query-devtools": "^5.90.2", + "@tanstack/solid-query": "^5.90.3", + "@tanstack/solid-query-devtools": "^5.90.3", "graphql": "^16.9.0", "graphql-request": "^7.1.2", "solid-js": "^1.9.7" diff --git a/examples/solid/basic/package.json b/examples/solid/basic/package.json index 2022c42036..828445c51c 100644 --- a/examples/solid/basic/package.json +++ b/examples/solid/basic/package.json @@ -8,8 +8,8 @@ "preview": "vite preview" }, "dependencies": { - "@tanstack/solid-query": "^5.90.2", - "@tanstack/solid-query-devtools": "^5.90.2", + "@tanstack/solid-query": "^5.90.3", + "@tanstack/solid-query-devtools": "^5.90.3", "solid-js": "^1.9.7" }, "devDependencies": { diff --git a/examples/solid/default-query-function/package.json b/examples/solid/default-query-function/package.json index f68b8b7abb..bfeda34e48 100644 --- a/examples/solid/default-query-function/package.json +++ b/examples/solid/default-query-function/package.json @@ -8,8 +8,8 @@ "preview": "vite preview" }, "dependencies": { - "@tanstack/solid-query": "^5.90.2", - "@tanstack/solid-query-devtools": "^5.90.2", + "@tanstack/solid-query": "^5.90.3", + "@tanstack/solid-query-devtools": "^5.90.3", "solid-js": "^1.9.7" }, "devDependencies": { diff --git a/examples/solid/simple/package.json b/examples/solid/simple/package.json index a9f7a572aa..1a98b88d2e 100644 --- a/examples/solid/simple/package.json +++ b/examples/solid/simple/package.json @@ -8,8 +8,8 @@ "preview": "vite preview" }, "dependencies": { - "@tanstack/solid-query": "^5.90.2", - "@tanstack/solid-query-devtools": "^5.90.2", + "@tanstack/solid-query": "^5.90.3", + "@tanstack/solid-query-devtools": "^5.90.3", "solid-js": "^1.9.7" }, "devDependencies": { diff --git a/examples/solid/solid-start-streaming/package.json b/examples/solid/solid-start-streaming/package.json index 5a9b502dee..25b2a09007 100644 --- a/examples/solid/solid-start-streaming/package.json +++ b/examples/solid/solid-start-streaming/package.json @@ -12,8 +12,8 @@ "@solidjs/meta": "^0.29.4", "@solidjs/router": "^0.15.3", "@solidjs/start": "^1.1.3", - "@tanstack/solid-query": "^5.90.2", - "@tanstack/solid-query-devtools": "^5.90.2", + "@tanstack/solid-query": "^5.90.3", + "@tanstack/solid-query-devtools": "^5.90.3", "solid-js": "^1.9.7", "vinxi": "^0.5.3" }, diff --git a/packages/solid-query-devtools/package.json b/packages/solid-query-devtools/package.json index 2d1259cf9b..30583c749a 100644 --- a/packages/solid-query-devtools/package.json +++ b/packages/solid-query-devtools/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/solid-query-devtools", - "version": "5.90.2", + "version": "5.90.3", "description": "Developer tools to interact with and visualize the TanStack/solid-query Query cache", "author": "tannerlinsley", "license": "MIT", diff --git a/packages/solid-query-persist-client/package.json b/packages/solid-query-persist-client/package.json index e423596490..60992818de 100644 --- a/packages/solid-query-persist-client/package.json +++ b/packages/solid-query-persist-client/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/solid-query-persist-client", - "version": "5.90.2", + "version": "5.90.3", "description": "Solid.js bindings to work with persisters in TanStack/solid-query", "author": "tannerlinsley", "license": "MIT", diff --git a/packages/solid-query/package.json b/packages/solid-query/package.json index d7c6c0ee68..a5ac718d5b 100644 --- a/packages/solid-query/package.json +++ b/packages/solid-query/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/solid-query", - "version": "5.90.2", + "version": "5.90.3", "description": "Primitives for managing, caching and syncing asynchronous and remote data in Solid", "author": "tannerlinsley", "license": "MIT", From cd290631abacc9aa1f73e18e16f471bb2ceca94e Mon Sep 17 00:00:00 2001 From: Cam Jackson <1930451+camjackson@users.noreply.github.com> Date: Wed, 24 Sep 2025 22:41:36 +1000 Subject: [PATCH 03/39] docs(react-query): add caveat for typing getQueriesData (#9684) --- docs/framework/react/typescript.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/framework/react/typescript.md b/docs/framework/react/typescript.md index d9fe0319ed..59f56d3268 100644 --- a/docs/framework/react/typescript.md +++ b/docs/framework/react/typescript.md @@ -237,6 +237,13 @@ Without `queryOptions`, the type of `data` would be `unknown`, unless we'd pass const data = queryClient.getQueryData(['groups']) ``` +Note that type inference via `queryOptions` does _not_ work for `queryClient.getQueriesData`, because it returns an array of tuples with heterogeneous, `unknown` data. If you are sure of the type of data that your query will return, specify it explicitly: + +```ts +const entries = queryClient.getQueriesData(groupOptions().queryKey) +// ^? const entries: Array<[QueryKey, Group[] | undefined]> +``` + ## Typing Mutation Options Similarly to `queryOptions`, you can use `mutationOptions` to extract mutation options into a separate function: From 2a15f36576b37e261b366f6984d51a97acdd245b Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Fri, 26 Sep 2025 17:32:23 +1000 Subject: [PATCH 04/39] ci: introduce changesets (#9502) * ci: introduce changesets * Avoid using changesets/action * Remove PR permission * Update PR template * Update link --- .changeset/config.json | 13 + .github/pull_request_template.md | 13 + .github/workflows/release.yml | 23 +- CONTRIBUTING.md | 76 +---- integrations/angular-cli-20/package.json | 3 +- package.json | 6 +- pnpm-lock.yaml | 386 ++++++++++++++++++++++- scripts/publish.ts | 119 ------- 8 files changed, 415 insertions(+), 224 deletions(-) create mode 100644 .changeset/config.json create mode 100644 .github/pull_request_template.md delete mode 100644 scripts/publish.ts diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 0000000000..0e32a8b571 --- /dev/null +++ b/.changeset/config.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json", + "changelog": [ + "@svitejs/changesets-changelog-github-compact", + { "repo": "TanStack/query" } + ], + "commit": false, + "access": "public", + "baseBranch": "main", + "updateInternalDependencies": "patch", + "fixed": [], + "linked": [] +} diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000000..11deb8f95f --- /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 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/workflows/release.yml b/.github/workflows/release.yml index 9f2028696d..d2dfa41c73 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,11 +1,6 @@ -name: ci +name: Release on: - workflow_dispatch: - inputs: - tag: - description: override release tag - required: false push: branches: [main, alpha, beta, rc, v4] @@ -39,16 +34,20 @@ jobs: - name: Stop Nx Agents if: ${{ always() }} run: npx nx-cloud stop-all-agents - - name: Publish + - name: Version Packages + run: pnpm run changeset:version + - name: Commit version files run: | git config --global user.name 'Tanner Linsley' - git config --global user.email 'tannerlinsley@users.noreply.github.com' - npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" - pnpm run cipublish + git config --global user.email 'tannerlinsley@users.noreply.github.com' git add -A + git commit -m "ci: Version Packages" + git push + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Publish Packages + run: pnpm run changeset:publish env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - TAG: ${{ inputs.tag }} - name: Upload coverage to Codecov uses: codecov/codecov-action@v4.6.0 with: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cb7ff182cc..2d90db264c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -155,79 +155,9 @@ You can use Gitpod (An Online Open Source VS Code like IDE which is free for Ope [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/TanStack/query) -## Commit message conventions +## Changesets -`TanStack/query` is using [Angular Commit Message Conventions](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines). - -We have very precise rules over how our git commit messages can be formatted. This leads to **more readable messages** that are easy to follow when looking through the **project history**. - -### Commit Message Format - -Each commit message consists of a **header**, a **body** and a **footer**. The header has a special -format that includes a **type**, a **scope** and a **subject**: - -```text -(): - - - -