Describe the bug
I have some disabled queries awaiting for some change on my components.
And even if the value doesn't change, the queryFn is called at each refetchInterval.
To Reproduce
const [neverUpdatedValue] = React.useState(null);
useQuery({
queryKey: ["test", neverUpdatedValue],
queryFn: (key, value) => {
console.log(key, value);
return Promise.resolve();
},
config: {
enabled: !!neverUpdatedValue,
refetchInterval: 2000
}
});
I set up a sandbox derived from your "Basic" example :
https://codesandbox.io/s/busy-moon-pon1t?file=/src/index.js
The refretchInterval triggers the queryFn even if it is disabled.
Expected behavior
Do not trigger the queryFn.
Desktop (please complete the following information):
@tannerlinsley , Can you please guide me, I would love to work on this to fix if this is an issue? If you could help me how to approach I can start looking into it. Thank You.
Yeah sure. This line here would need an extra check before running anything that there is at least one query that is enabled (instance.config.enabled).
:tada: This issue has been resolved in version 2.4.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Still isn't fixed in the released version mentionned above.
https://codesandbox.io/s/sad-roentgen-8g0yc?file=/src/index.js
The issue #648 probably reports the same problem.
Just released a fix again. 馃憤
Most helpful comment
Just released a fix again. 馃憤