Replies: 1 comment 1 reply
-
weird, but fyi, the object syntax is the only one that will be supported from v5 onwards, so it's a good idea to switch to it regardless :) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working to standardize our query keys to use simple factories, sort of based around this post. Here's what one looks like:
Introducing it into the codebase looked like this:
The factory supplies the query key, in array format, adding the
{ limit: 1 }
param bit to the key. For simplicity's sake I pull theparams
object back out of thequeryKey
object on the next line.Easy. TypeScript loves it. Works in the browser.
However in the Jest environment I'm receiving a
Missing queryFn
error. The weird part is that when switch the above code in the screenshot to this, the tests stop complaining:It's odd since the signature (
useQuery(queryKey, queryFn, options)
) worked before the introduction of the query key generator but now seems to lose the query function somewhere in the mix.Does anyone have any idea what might be going wrong at the proverbial post office?
Beta Was this translation helpful? Give feedback.
All reactions