You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like injectInfiniteQuery that depends on some signal-based param, like query() for the queryKey/queryFn, is not working as expected when we use the .refetch() directly after updating the query signal, something like:
refetch() should work as expected without setTimeout()
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
OS: macOS 15.5
Browser: latest chrome
Tanstack Query adapter
angular-query
TanStack Query version
v5.76.0
TypeScript version
v5.8.2
Additional context
in my environment with v5.51.15, the HTTP call is made with the wrong param (the previous query() value)
and I tried to repro it with stackblitz, where it behaves differently (probably because of different versions) - but still not as expected.
The text was updated successfully, but these errors were encountered:
This likely a consequence of using effect in the definition of the injection function as effect unlike computed will only run eventually after the dependencies have been updated. As a fix, one could, therefore, consider removing the effects as proposed for injectMutation in #9098.
Describe the bug
It seems like
injectInfiniteQuery
that depends on some signal-based param, likequery()
for the queryKey/queryFn, is not working as expected when we use the.refetch()
directly after updating the query signal, something like:then
This isn't working (view stackblitz)
The solution is to delay the refetch call:
Your minimal, reproducible example
https://stackblitz.com/edit/sb1-6pedarrr?file=src%2Fapp%2Fcomponents%2Fposts-list%2Fposts-list.component.ts
Steps to reproduce
type
sit
in the search inputpress
Search
buttonthis will trigger a
.refetch()
with the updated search term and show the results as expectedremove the
setTimeout()
in the end of the file, and callrefetch()
directlyExpected behavior
refetch()
should work as expected withoutsetTimeout()
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
Tanstack Query adapter
angular-query
TanStack Query version
v5.76.0
TypeScript version
v5.8.2
Additional context
in my environment with v
5.51.15
, the HTTP call is made with the wrong param (the previous query() value)and I tried to repro it with stackblitz, where it behaves differently (probably because of different versions) - but still not as expected.
The text was updated successfully, but these errors were encountered: