0
Fork 0
mirror of https://github.com/TanStack/query.git synced 2026-11-18 19:33:22 +00:00
Commit graph

451 commits

Author SHA1 Message Date
github-actions[bot]
5cc606e2e8
ci: Version Packages (#12301)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-26 10:28:34 +01:00
Wonsuk Choi
d09972b850
test(*): rename the 'queryKey' test helper to 'createKey' since it creates keys for both queries and mutations (#12293)
* test(*): rename the 'queryKey' test helper to 'createKey' since it creates keys for both queries and mutations

* test(query-test-utils/createKey): change the key prefix from 'query_' to 'key-' since it is also used for mutation keys
2026-10-23 15:32:13 +09:00
Wonsuk Choi
84332ded75
chore({react-query,preact-query,query-broadcast-client-experimental}/vite.config): remove the CI-only 'retry' (#12279) 2026-10-22 17:21:04 +09:00
Wonsuk Choi
4b17d51f5c
test(*): remove manual 'mockRestore' calls already handled by 'restoreMocks' (#12277)
* test(*): remove manual 'mockRestore' calls already handled by 'restoreMocks'

* test(vue-query): unwrap the 'try' / 'finally' blocks that only call 'mockRestore'
2026-10-22 16:53:42 +09:00
Wonsuk Choi
07bdb6bbec
chore(oxlint.config): enable 'vitest/require-mock-type-parameters' and type the mock functions (#12251) 2026-10-21 21:00:25 +09:00
Wonsuk Choi
5c7b9dbbce
chore(oxlint.config): enable 'vitest/prefer-strict-equal' and assert with 'toStrictEqual' (#12250)
* chore(oxlint.config): enable 'vitest/prefer-strict-equal' and assert with 'toStrictEqual'

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-10-21 20:06:34 +09:00
Wonsuk Choi
c1dc50c36c
chore(oxlint.config): enable 'vitest/prefer-import-in-mock' and type the module mocks against the real modules (#12243) 2026-10-21 16:26:26 +09:00
Wonsuk Choi
22d9966fba
chore(oxlint.config): enable 'vitest/prefer-called-with' and assert the call arguments with 'toHaveBeenCalledWith' (#12237) 2026-10-21 14:52:07 +09:00
github-actions[bot]
a8ecc8d42f
ci: Version Packages (#12128)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-19 18:54:46 +02:00
github-actions[bot]
12199722dc
ci: Version Packages (#12062)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-17 19:51:17 +02:00
github-actions[bot]
ee47993724
ci: Version Packages (#11998)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-15 09:50:17 +02:00
github-actions[bot]
b699b52d60
ci: Version Packages (#11849)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-11 21:32:27 +02:00
Dominik Dorfmeister 🔮
e22e7c4a27
chore: test TypeScript 7.1 preview and drop 5.6 (#11947)
* chore: test TypeScript 7.1 preview and drop 5.6

* chore: use a mature TypeScript 7.1 preview
2026-10-10 16:26:58 +02:00
Wonsuk Choi
df78a9d137
chore(*): pass the root 'settings' to the package oxlint configs, which 'extends' does not inherit (#11941) 2026-10-10 01:39:06 +09:00
Ciarán Curley
d0cfa6a4a8
chore: replace eslint with oxlint (#11938)
* chore: replace eslint with oxlint

Migrates to oxlint as the replacement linter for eslint.

Keeps the existing ruleset, runs js plugins for non-native oxlint rules and the local no-restricted-syntax plugin

Svelte packages keep a slim ESLint config for the svelte/* rules, which need the component template.
React examples that use the query eslint plugin also still use eslint for now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore: use oxlint disable directives

ESLint no longer lints these files, so switch eslint-disable comments to
oxlint-disable and the @typescript-eslint/ prefix to typescript/. Remove
directives that oxlint reports as unused, and name the rule in the
cspell oxlint-enable comments, which oxlint does not match to a
rule-specific disable otherwise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore: lint expectTypeOf with vitest valid-expect

Oxlint's native vitest/valid-expect only checks `expect` calls, so load
@vitest/eslint-plugin as a JS plugin for this rule to keep flagging
`expectTypeOf` calls without a matcher, and restore the directives for
the intentional ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:35:33 +01:00
Wonsuk Choi
0aa83a0188
docs(*): add JSDoc to the properties of the exported interfaces and type aliases of the persisters and the broadcast client (#11893) 2026-10-05 01:49:21 +09:00
Wonsuk Choi
91f5d9b6c3
docs(*): add missing JSDoc to the persisters and the broadcast client (#11846)
* docs(*): add missing JSDoc to the persisters and the broadcast client

* docs(*): describe the broadcast event filters and the restore cleanup errors
2026-10-04 04:17:55 +09:00
Wonsuk Choi
5ab1aaeddf
chore(eslint.config): use 'defineConfig' from 'eslint/config' (#11819) 2026-10-03 23:17:10 +09:00
github-actions[bot]
29859ae60c
ci: Version Packages (#11806)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-02 12:02:10 +02:00
Wonsuk Choi
e878990b86
chore(*): manage 'react' packages with pnpm 'catalog' (#11712) 2026-09-28 18:49:08 +09:00
Wonsuk Choi
2e1ad64b52
chore(*): declare 'npm-run-all2' once in the root 'package.json' like other shared tools (#11710) 2026-09-28 13:13:48 +09:00
Wonsuk Choi
c1de23a80e
chore(*): manage 'typescript' with pnpm 'catalog' and declare it in each package so 'tsc' runs the default version (#11705) 2026-09-28 10:04:50 +09:00
Wonsuk Choi
024d89d4bb
chore(*): add 'tsconfig.legacy.json' and use it for type checks on older TypeScript versions (#11704) 2026-09-28 01:56:41 +09:00
Wonsuk Choi
743af679f9
test(query-core): keep each action, wait and assertion together and separate setup and each new action (#11664)
* test(query-core): keep each action, wait and assertion together and separate setup and each new action

* test(query-persist-client-core,query-*-storage-persister,query-broadcast-client-experimental): keep each action, wait and assertion together
2026-09-27 01:43:06 +09:00
github-actions[bot]
d4033eb1e5
ci: Version Packages (#11651)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-26 13:53:37 +10:00
Lachlan Collins
5279b05211
chore(deps): update Vite from v6 to v8 (#11650)
* chore(deps): update Vite from v6 to v8

* Fix angular, vue-devtools

* Fix vue-devtools

* Fix knip, remove @tanstack/vite-config

* Update eslint config

* Disable false eslint errors

* Fix remaining errors

* Fix knip, dedupe esbuild

* Add changeset
2026-09-26 12:23:02 +10:00
github-actions[bot]
fe053bf8e9
ci: Version Packages (#11612)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-26 10:13:58 +10:00
Lachlan Collins
f00aad602e
chore(deps): update dev dependencies (#11640)
chore(deps): update many dev dependencies
2026-09-26 07:30:31 +10:00
Wonsuk Choi
fd64c13e68
test(*): rename 'console.warn' spies to 'consoleWarnMock' (#11645) 2026-09-26 00:28:28 +09:00
Lachlan Collins
57f40eb05b
chore(deps): update non-major dependencies (#11625)
* chore(deps): update non-major dependencies

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-09-25 15:15:46 +10:00
github-actions[bot]
e0f6c5542f
ci: Version Packages (#11525)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-21 11:29:33 +02:00
Lazizbek Ergashev
322152569e
fix(broadcast-client): don't overwrite an existing query's data on an incoming 'added' message (#11392)
* fix(broadcast-client): don't overwrite an existing query's data on an incoming 'added' message

* test(query-broadcast-client-experimental): drop test that duplicates existing 'added' build coverage
2026-09-21 10:50:04 +02:00
github-actions[bot]
c08f5766dd
ci: Version Packages (#11511)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-16 16:56:55 +02:00
github-actions[bot]
19ccf2794b
ci: Version Packages (#11339)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-16 09:03:53 +02:00
Dominik Dorfmeister 🔮
58ad3e2f08
fix: isolate TypeScript test output (#11503) 2026-09-15 20:56:41 +02:00
github-actions[bot]
2969edf32f
ci: Version Packages (#11316) 2026-08-28 01:03:02 +09:00
github-actions[bot]
2eb3c7c76f
ci: Version Packages (#11313)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-27 17:28:48 +09:00
github-actions[bot]
714df67ab1
ci: Version Packages (#11306)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-26 20:32:28 +02:00
github-actions[bot]
1836e61b8c
ci: Version Packages (#11303)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-26 10:56:25 +02:00
github-actions[bot]
51f12db919
ci: Version Packages (#11294)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-25 23:24:07 +02:00
github-actions[bot]
730b3aa06c
ci: Version Packages (#11276) 2026-08-25 04:21:47 +09:00
github-actions[bot]
388bbaf181
ci: Version Packages (#11265)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-23 19:57:36 +02:00
github-actions[bot]
bc423b37ef
ci: Version Packages (#11261)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-23 12:57:01 +02:00
github-actions[bot]
5743468462
ci: Version Packages (#11206)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-22 20:52:42 +02:00
Wonsuk Choi
c9dba0736c
test(query-broadcast-client-experimental): replace inline query key literals with 'queryKey' in incoming message tests (#11247) 2026-08-22 10:48:36 +09:00
한국
6796c51275
fix(broadcast-client): recover from errors thrown while applying an incoming cross-tab message (#11242)
* fix(broadcast-client): recover from errors thrown while applying an incoming cross-tab message

If applying an incoming cross-tab message (query.setState/queryCache.build,
which notifies observers) throws, the internal `tx()` helper's `transaction`
flag was never reset. This silently disabled all future outgoing broadcasts
from this tab for the rest of the session. Guard with try/finally so a single
failed message can't permanently break cross-tab sync.

* test(broadcast-client): also cover the query.setState throw path

The existing regression test only exercised queryCache.build (a brand-new
remote query hash). Add a case where the incoming message targets an
existing query, so an exception during query.setState is exercised too.

Addresses CodeRabbit review feedback on #11242.
2026-08-21 11:50:13 +02:00
Wonsuk Choi
2fbe04e492
test(query-broadcast-client-experimental): replace inline 'new Promise' timeouts with 'sleep' from 'query-test-utils' (#11241) 2026-08-21 13:56:29 +09:00
Wonsuk Choi
bec1f1b286
test(query-broadcast-client-experimental): replace inline query key literals with 'queryKey' from 'query-test-utils' (#11240) 2026-08-21 13:47:08 +09:00
n-satoshi061
3c79861ab1
fix(broadcast-client): handle unhandled postMessage rejections (#10771)
* fix(broadcast-client): handle unhandled postMessage rejections

Wrap channel.postMessage() calls in safePost() to catch DataCloneError
and similar failures that occur when query data contains non-cloneable
values (ReadableStream, Response, Vue reactive proxies, etc.).

Adds an optional onBroadcastError callback to BroadcastQueryClientOptions
so consumers can pipe errors to Sentry/Datadog. Falls back to console.warn
in development when the callback is not provided.

Fixes #10543

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(broadcast-client): guard against throwing onBroadcastError callback

Wrap onBroadcastError() in a try/catch so that if the callback itself
throws, the error does not escape as an unhandled rejection. Falls back
to console.warn in development when the callback throws.

Add a test asserting no unhandledRejection fires when onBroadcastError throws.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(broadcast-client): handle async onBroadcastError rejections

Support async onBroadcastError callbacks by calling .catch() on the
returned Promise, preventing unhandled rejections when the callback
rejects asynchronously.

Also extracts the console.warn fallback into warnBroadcastError to
deduplicate the warning logic.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(broadcast-client): use try/finally to ensure unhandledRejection listener cleanup

Prevents listener leaks into subsequent tests if an assertion throws
before process.off() is reached.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(broadcast-client): improve types, messages, and docs

- Export BroadcastErrorEvent interface with QueryKey typing so consumers
  can import the type directly
- Use discriminated union for internal BroadcastMessage (state only on
  updated) for more precise typing
- onBroadcastError now receives BroadcastErrorEvent (no internal state
  field) instead of the raw BroadcastMessage
- Differentiate dev warning messages: broadcast failures explain the
  structured-clone cause and consequence; onBroadcastError failures
  explicitly identify the hook as the source
- Remove warnBroadcastError helper in favour of context-specific inlined
  warn calls
- Fix duplicate queryClient.getQueryCache() call (use queryCache directly)
- Add JSDoc to all BroadcastQueryClientOptions fields
- Add onBroadcastError section to broadcastQueryClient docs with Sentry
  example

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(broadcast-client): assert warn message when onBroadcastError throws or rejects

Add two tests that verify the '[broadcastQueryClient] onBroadcastError
threw while handling...' console.warn message is emitted in development
when the onBroadcastError callback itself throws synchronously or rejects
asynchronously.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(broadcast-client): include state in 'added' broadcasts

The receiver's onmessage handler reads state for 'added' events to call
query.setState(state) and queryCache.build(..., state), but the sender
was not including state in the outbound message. This caused receiving
tabs to apply undefined state for newly added queries.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(broadcast-client): wrap warnSpy in try/finally to prevent spy leakage

If an assertion fails before mockRestore(), the console.warn spy would
leak into subsequent tests. Wrapping each spy block in try/finally
ensures restore always runs regardless of test outcome.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: apply automated fixes

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-08-20 10:24:33 +02:00
Dominik Dorfmeister 🔮
267154cf6b
chore: tsup -> tsdown (#11222)
* chore: tsup -> tsdown

* revert size-limit and fix the build instead

* fix angular and devtools build

* fix nextJs builds

* more solid related things

* fix: import order
2026-08-18 15:19:43 +02:00