* fix(query-core): unpause a mutation that can start after its onMutate
Mutation.execute() computes isPaused before it awaits the MutationCache and
mutation onMutate callbacks, and dispatches pending with that value. When the
mutation cannot start at that point (queued behind another mutation in its
scope, or offline) but can by the time onMutate resolves, retryer.start()
runs it directly instead of going through pause(), so no continue action is
dispatched and the mutation reports isPaused: true for its whole request.
defaultShouldDehydrateMutation and resumePausedMutations read that flag, so
the in-flight mutation is dehydrated as not yet sent and runs a second time
after a restore.
Dispatch continue right before start() when the mutation is still marked
paused but can start now, as #9015 does for a restored mutation.
Source: packages/query-core/src/mutation.ts execute(),
packages/query-core/src/retryer.ts start(), hydration.ts
defaultShouldDehydrateMutation.
* test(query-core): use createKey in mutation regression test
---------
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
* refactor(examples/react/nextjs-app-optimistic-updates): type the form submit handlers with 'React.SubmitEvent' instead of the deprecated 'React.FormEvent'
* chore(examples/react/nextjs-app-optimistic-updates/package.json): raise the '@types/react' minimum to '^19.2.10' for 'React.SubmitEvent'
* fix(query-core): handle the rejection of paused refetches in 'refetchQueries' with 'throwOnError'
* refactor(query-core): reuse paused status in refetchQueries
* docs(query-core): clarify paused refetch promise behavior
---------
Co-authored-by: TkDodo <office@dorfmeister.cc>
* fix(query-core): addToEnd caps result to max when items already exceeds max
addToEnd(items, item, max) used slice(1) which only ever removed one
element. When items.length > max (e.g. maxPages reduced at runtime),
the returned array could still exceed max.
Replace slice(1) with slice(-max) so the result is always the last
max elements of the extended array, regardless of input length.
* fix(query-core): cap prepended items to max
---------
Co-authored-by: JSap0914 <JSap0914@users.noreply.github.com>
Co-authored-by: TkDodo <office@dorfmeister.cc>
* fix(query-core): shallowEqualObjects ignores key-set differences when counts match
`shallowEqualObjects` only iterated the keys of `a` and compared `a[key] !== b[key]`.
When both objects have the same number of keys but different key names, a key
present on `a` but absent on `b` reads as `undefined` on `b`; if the corresponding
value on `a` is also `undefined` (or otherwise equal), the function incorrectly
reported the objects as equal. This breaks the documented "shallow compare objects"
contract and can suppress an `observerOptionsUpdated` notification when an observer's
defaulted options swap one key for another between renders.
Fix: require each key of `a` to be an own-property of `b` before comparing values.
* fix(query-core): ignore inherited properties in shallow equality
* test(query-core): use toBe for shallow equality assertions
---------
Co-authored-by: safechem <sales@alphachemicals.ie>
Co-authored-by: TkDodo <office@dorfmeister.cc>
* fix(react-query): set the observer options before subscribing so revealing an 'Activity' does not fetch the previous key
* fix(preact-query): set the observer options before subscribing
* test(react-query): cover Activity reveal for all query hooks
Port vkpdeveloper's Activity regression tests from TanStack/query#12283.
* test(react-query): use createKey in Activity coverage
* test: update Activity regressions for current helpers and lint rules
---------
Co-authored-by: TkDodo <office@dorfmeister.cc>
* docs(examples): add router and framework suffix to example directories to match their 'package.json' names
* docs(svelte): update example links to the renamed 'basic-sveltekit' and 'ssr-sveltekit' directories
* docs(lit): remove '@tanstack/query-core' from the install commands since 'lit-query' already depends on it
* docs(lit): remove 'lit' from the install commands since apps using Lit Query already have it
* fix(lit-query/package.json): remove '@tanstack/query-core' from 'peerDependencies' since it is already a dependency
* docs(lit): restore the install commands to move them to a separate change
* fix(lit-query/package.json): move 'lit' from 'dependencies' to 'devDependencies' so it is declared only as a peer dependency
* test(solid-query): access query and mutation results through their object instead of destructuring them
* test(svelte-query): access query results through their object instead of destructuring them
* test(svelte-query/createInfiniteQuery): access the error booleans through the query object instead of destructuring them
* test(solid-query-persist-client/PersistQueryClientProvider): access the 'useQueries' result by index instead of destructuring it
* docs({react,preact,angular,solid,svelte,vue}-query): describe the 'initialData' overloads as 'known to be defined' and 'omitted or may be undefined'
* docs({react,preact,angular,solid,svelte,vue}-query): regenerate reference docs
* docs({react,preact,angular,solid,svelte,vue}-query): mention an 'initialData' function that may return 'undefined' in the 'Undefined' overload descriptions
* docs({react,preact,angular,solid,svelte,vue}-query): regenerate reference docs
* fix({react,preact,angular}-query): remove erroneous '| undefined' from 'DefinedInitialDataInfiniteOptions'
* test({react,preact,angular}-query/infiniteQueryOptions): use a non-literal condition for the ternary 'initialData' test
* fix({solid,vue}-query): accept a possibly-undefined 'initialData' in 'UndefinedInitialDataInfiniteOptions'
* fix(vue-query/infiniteQueryOptions): declare the 'Defined' overload first so a defined 'initialData' still selects it
* docs({react,preact,angular,solid,vue}-query): drop generated reference doc changes, regenerated by autofix after merge
* chore(.changeset): align the message with the PR title
* docs({react,preact,angular,solid,vue}-query/infiniteQueryOptions): describe overload selection by whether 'initialData' is known to be defined
* docs(framework/*/reference): regenerate reference docs
* docs(framework): restore the generated reference docs from main and leave them to autofix
* docs({react,preact,angular,solid,vue}-query): regenerate reference docs
* test({react,preact,angular,solid,vue}-query/infiniteQueryOptions): start test titles with 'should'
* docs(examples): add router and framework suffix to 'docs/config.json' labels and 'package.json' names
* docs(examples): distinguish Next.js App/Pages Router and Nuxt/SolidStart major versions in example labels and names
* chore(examples/vue): add 'eslint-plugin-vue' and 'eslint-config-prettier' to all examples and '@nuxt/eslint' to Nuxt examples
* refactor(examples/vue): rename single-word components and hyphenate template attributes and events
* fix(examples): validate ids, handle HTTP and loader errors, and show watchers and unknown locations correctly
* fix(examples/{batching,prefetching}): disable loading while input is invalid and reject non-decimal character ids
* refactor(examples/svelte): declare '$props()' with 'let' and type them with 'Props', 'LayoutProps' and 'PageProps'
* test(svelte-query,svelte-query-persist-client): declare '$props()' with 'let' and type them with 'Props'
* refactor(svelte-query/HydrationBoundary): declare '$props()' with 'let'
* docs(examples/svelte): add 'basic-graphql-request', 'default-query-function', 'shadow-dom', 'algolia' and 'chat' examples
* docs(examples/svelte): declare '$props()' with 'let' in the new examples
* docs(examples/svelte/{basic-graphql-request,default-query-function}): prevent the hash navigation on the post links