If I set the queryFn to skipToken, can I omit the queryKey?
In the docs example:
when filter is undefined the queryKey becomes
['todos', undefined]. As far as I can tell this key will never result in a meaningful cache hit because data is never returned for this key. I would like to not have to generate a queryKey if I have empty arguments. Is this possible? I could set the queryKey to a dummy value like ['disabled'] but this could cause other problems if the same key is used elsewhere.4 Replies
rare-sapphire•9mo ago
queryKey: filter ? ['todos', filter] : ['todos']rival-blackOP•9mo ago
Is there a particular reason you've chosen
['todos']? Could it be ['bananas']?
The reason I ask is that I have a queryFactoryFunction that produces a valid queryKey and queryFunction or nothing at all. I'm unable to make a dummy queryKey in a typesafe way currently.
I understand you have picked it because it helps you identify the query but functionally could it be anything and the behaviour would be the same?rare-sapphire•9mo ago
Could be anything
rival-blackOP•9mo ago
Ok, thanks