Replies: 1 comment 1 reply
-
|
show a minimal reproduction please. My first guess is you’re using the same queryKey between an infinite query and a normal query and that errors out somewhere. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm seeing a strange difference between
useInfiniteQueryanduseQueryregardingrefetchOnMount.Expected
When a component unmounts (so the query has 0 observers) and then mounts again,
useInfiniteQueryshould refetch on mount when:refetchOnMountis set to"always"(ortrue)enabled: trueThis works correctly with
useQuery.Actual
With
useInfiniteQuery:state = stale,refetchOnMount: "always", andrefetchOnWindowFocus: false.fetchStatusstays"idle".The same configuration with
useQuerydoes refetch correctly on mount.Environment / Extra context
"@tanstack/react-query": "^5.90.10","@tanstack/react-query-devtools": "^5.91.1"useEffect(() => console.log("MOUNT"), [])fires).staleTimeoverriding behavior.retry,enabled: false, etc.getNextPageParam, nothing unusual.infiniteOptions) but Devtools confirms the observer does receive the correct options, includingrefetchOnMount: "always".Devtools snapshot on mount
refetchOnMount: "always"refetchOnWindowFocus: falsesuccessidle_optimisticResults: "optimistic"Question
Is this a known limitation or bug with
useInfiniteQuery?Is there any documented difference in how
refetchOnMountworks for infinite queries vs regular queries?Or is this possibly related to optimistic results or observer lifecycle?
Any guidance or workarounds would be appreciated.
(For now I'm manually calling
refetch()on component mount.)Beta Was this translation helpful? Give feedback.
All reactions