* fix(query-core): prevent reducer from being called twice in streamedQuery #9787
- Fix bug where reducer was called twice for each chunk (once in setQueryData, once in loop)
- Store reducer result in variable to avoid duplicate calls
- Add test case to verify reducer is only called once per chunk
* fix(streamed-query): prevent reducer from being called twice
Fixed an issue where the reducer was being invoked twice when refetchMode is set to 'replace'.
Added a regression test to verify the fix.
Fixes#9787
* docs: add changeset and lockfile update
* fix(changeset): change version bump to patch
* Update streamedQuery.test.tsx
fix: lint
* fix: support refetchMode append and prevent double reducer calls
- Fix refetchMode append to preserve existing data on refetch
- Fix reducer being called twice by calling it once and storing result
- Update pnpm-lock.yaml to match main branch
* chore: update pnpm-lock.yaml to include size-limit dependencies
* ci: apply automated fixes
* refactor: simplify streamedQuery logic with clearer isReplaceRefetch condition
- Extract isReplaceRefetch variable for better readability
- Use explicit if-else instead of negated conditions
- Make it clearer when reducer is called in each branch
---------
Co-authored-by: TkDodo <office@dorfmeister.cc>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* chore: move consume aware signal logic to utils
* fix: add consume aware signal to streamedQuery
* test: add a test for not a signal that is not consumed by streamFn
* chore: add changeset
* fix: made queryFn of streamedQuery not consume signal directly (so that only streamFn can consume it)
* fix: made onCancelled get called only once
* fix: memoized getSignal and made sure it is called only once
* fix: no-unnecessary-condition
* chore: size-limit
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* feat: size-limit
* fix: script
* fix: add test:size to nx
* fix: skip install and build
* really
* fix: size-limit options
* ok we need build step
* fix: test-size runs as part of its own action
docs: update bundlephobia links to @tanstack/react-query
The bundlephobia links were pointing to the old react-query package (v3)
instead of the current @tanstack/react-query package.
Co-authored-by: Claude <noreply@anthropic.com>
* test(svelte-query-persist-client/PersistQueryClientProvider): switch to fake timers, replace 'waitFor' with 'advanceTimersByTimeAsync', and use 'sleep().then()' pattern
* test(svelte-query-persist-client/PersistQueryClientProvider): replace 'setQueryDefaults' with 'onFetch' callback in FreshData
* refactor(svelte-query-persist-client/FreshData): convert complex 'then' callback to async/await pattern
* test(angular-query-persist-client/withPersistQueryClient): switch to fake timers, replace 'waitFor' with 'advanceTimersByTimeAsync', use 'sleep().then()' pattern, replace 'screen' with 'rendered', add 'toBeInTheDocument', and add '@testing-library/jest-dom/vitest'
* test(angular-query-persist-client/withPersistQueryClient): replace 'async/await' with 'sleep().then()' pattern in queryFn and restoreClient
* refactor(angular-query-persist-client/withPersistQueryClient.test): convert complex 'then' callbacks to async/await pattern
* test(solid-query-persist-client/PersistQueryClientProvider): switch to fake timers, replace 'waitFor' with 'advanceTimersByTimeAsync', and use 'sleep().then()' pattern
* refactor(solid-query-persist-client/PersistQueryClientProvider.test): convert complex 'then' callback to async/await pattern
* fix: update react and nextJs
and add a nextJs16 integration test
* ci: apply automated fixes
* oops
* Update patch versions for React and TanStack packages
Updated the patch versions for various React and TanStack packages.
* fix: streamline dependencies
* bundle size
* fix lock file
* fix: update react in example
* skip test for now
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* docs(vue): change query keys example to typescript
This example is written in Javascript, and the fact that `todoId` is a `Ref` is a bit hard to identify.
I propose to migrate this example to Typescript, with an import to Vue's Ref type and make the parameter to the example composable explicit.
There are more docs that could be improved this way, if it suits you I could also make the changes to these docs :)
* ci: apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* fix(streamedQuery): fall back to initialValue when stream yields no values
Add failing test for empty streams and update implementation to avoid returning undefined.
Includes changeset for patch release.
* chore: address review nitpicks (JSDoc + test cleanup)
* docs: note that initialValue is returned when the stream yields no values
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>