TanStackT
TanStack3y ago
6 replies
efficient-indigo

Issue with onFocus after updating to react-query v5

After migrating from v4 to v5, I am getting the error below in the queryCache.ts file.

I'm only using useMutation() and in the options for that method there is no option to turn off refetching when the window is focused.
So I tried setting the option refetchOnWindowFocus to true, which the official documentation says turns off refetch globally at queryClient initialization, but the error is the same.

I tried debugging the query.onFocus() code in queryCache, and the query object is a MapIterator.

I didn't change any code, just updated the version, and I'm very puzzled to get this error!

Any help would be greatly appreciated.
image.png
Was this page helpful?