You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exportfunctiongetQueryKey<TInput,TResult,TextendsQueryFn>(resolver: T|Resolver<TInput,TResult>|EnhancedResolverRpcClient<TInput,TResult>,params?: TInput,key?: string// <= 🆕){if(typeofresolver==="undefined"){thrownewError("getQueryKey is missing the first argument - it must be a resolver function")}returngetQueryKeyFromUrlAndParams(sanitize(resolver)._meta.apiUrl,params,key)// Pass down the key}
What do you want and why?
What?
I want to be able to change manually the react-query cache key
Why?
I want to display multiples results based on different react-query keys, for example:
It allows us to have multiples results in cache and improve the UX or trigger a new request when the key change.
Possible implementation(s)
I'm pretty new to Blitz, here is some idea.
One possible implementation:
getQueryKey
util could have a third optional arg:react-query v2 impacted hooks:
useQuery
usePaginatedQuery
useInfiniteQuery
Additional context
Here is the original discussion: blitz-js/blitz#2128
Maybe related to Upgrade react-query to v3 - blitz-js/legacy-framework#518 because some hooks are deprecated in v3 (usePaginatedQuery)
The text was updated successfully, but these errors were encountered: