Replies: 4 comments
|
@shrynx You can use an array with a string and any number of serializable objects. |
0 replies
|
yup i totally can and should but as i mentioned, this more for adding warning when they keys in array is not string as they silently fail during |
0 replies
|
Isn't this what Typescript is for? |
0 replies
|
that seems fair, if Also useQuery automatically coerces |
0 replies
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.
Hi !
Thanks for the library, was longing for a solution like this for a while.
I got bit by this, had a query key like
['user', userId, 'posts']but whereuserIdwas a number.When using
useQueryit worked and the userId was shows as a string in devtools but when trying to refetch usingqueryCache.refetchQueriesit didn't work and silently failed.although this is clearly mentioned in the documentation, would also be nice if the library warns on non string query key variables. In my case i had forgotten userId is not string.
Another solution would be to have automatically convert to string using
JSON.stringify(that's what i end up doing most cases)Also i think
queryCache.refetchQuerieswhen provided with query keys that don't exists should also warnHappy to discuss further and make a PR if needed
All reactions