fl-query icon indicating copy to clipboard operation
fl-query copied to clipboard

Fix: prevent refresh when query is disabled #38

Open ganeshh123 opened this issue 11 months ago • 3 comments

Would appreciate it if you could check over it and suggest changes @PetrKubes97

ganeshh123 avatar Mar 06 '24 15:03 ganeshh123

Thanks for the PR. Sorry, I think I've led you in the wrong direction.

Looking at the code now, I'm thinking the following scenario:

  • I set enabled to false
  • I set refreshOnMount to true in the query client
  • I fetch the query (--> it is enabled now)
  • remount --> I would expect the query to refresh

You've also written:

Setting refreshOnMount explicitly doesn't seem to work on the disabled query either, it gets overriden by the QueryClientProvider it seems.

If useQuery(refreshConfig) gets overriden, it's definitely a bug.

PetrKubes97 avatar Mar 06 '24 18:03 PetrKubes97

Yeah, the query's refresh config should take precedence over the query client's right?

So how should we go about enforcing that?

ganeshh123 avatar Mar 07 '24 17:03 ganeshh123

I've taken a quick look at the code and I don't see any obvious mistakes.

A good first step would be to create an sample that reproduces the issue, for example in the examples folder.

PetrKubes97 avatar Mar 10 '24 10:03 PetrKubes97