Skip to content

error query doesn't fire again when keys change #2682

@TkDodo

Description

@TkDodo

Discussed in #2676

Originally posted by jdupont22 September 16, 2021
Hi,

I've a strange situation, i don't know if it's normal!
I try to load some "offers" with useQuery(["offers, deepJson]).

I have a "staleTime=20s" and the default "cacheTime=5m".

useQuery(["offers",{"order":"desc","page":1,"q":null,"size":10,"sort":"name","states":["ACTIVE"]}])

I've the following result, react-query retry 3 times and failed! It's ok.

Capture d’écran 2021-09-16 à 21 26 05

Now, I click on the tab "Inactive", that change the deepJson states to "states":["INACTIVE"]
I see in the react-query devtool the params change, but the request is not trigger!!!

There is a "disabled" query with this keys, but i would imagine that a query in error will retry the next time? it's based on the cache expiration?

Capture d’écran 2021-09-16 à 21 26 12

Can you explain to me this current behavior? When the query return 200 OK, switching tab work perfectly!

Thx

thanks for reporting. This seems to have worked correctly up until v3.19.4. I'll create an issue out of this.

Here is a slight variation of your codesandbox without window focus refetching, without retries, with a 1 second fetch delay and with devtools, so that we can better see when fetching transitions are happening: https://codesandbox.io/s/interesting-elbakyan-zz28f?file=/src/App.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions