Why is the key passed to the query function? #242
-
In v1, the query function now accepts the entire query key as the argument. For array based query keys, this means they now have a first param of key. function fetchData(key, ...rest) {
...
} I'm not sure I entirely understand the use case for this, so I'm interested to know a bit more about why support for this was added and use cases this comes in handy for. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
See #145 (comment) |
Beta Was this translation helpful? Give feedback.
-
I did just realize that the override doesn't support TypeScript since the type defs don't know about the query params filter. So TypeScript consumers will be forced to add the extra param to their fetch functions. |
Beta Was this translation helpful? Give feedback.
-
Or they could just use it and augment the type on their own. Just because the type isn't there yet doesn't mean you can't use it. |
Beta Was this translation helpful? Give feedback.
-
@tannerlinsley Does |
Beta Was this translation helpful? Give feedback.
-
Yes, all queries functions that use that signature support it, even |
Beta Was this translation helpful? Give feedback.
See #145 (comment)
And there's a way to override this behavior - see #145 (comment)