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
Hey Tanner, thank you for another amazing library.
I would like to suggest to add custom cache key from useQuery, since the query be can changed depending on the implementation, it would be very helpful to be able to control the cache key name
Though not fully documented yet. You can now use a custom queryID option to override the generated queryID normally returned from the function, eg.
// You must memoize the query function. useQuery will still detect changes to the// `query` reference and try to refetch if it changesconstqueryFn=React.useCallback(()=>axios.get('/todos'),[])// Then just pass a `queryID` string:useQuery(queryFn,{queryID: 'fetchTodos'})
Activity
tannerlinsley commentedon Sep 17, 2019
So instead of relying on the idempotency of the
queryfor the cache keying, you want to override the ID it would be given by an arbitrary string?tannerlinsley commentedon Sep 17, 2019
If that's the case, then we would need to propagate the manual key to this location here: https://github.com/tannerlinsley/react-query/blob/master/src/index.js#L524. It would need to originate in the query options and get passed through a few functions to get there.
tannerlinsley commentedon Sep 23, 2019
Though not fully documented yet. You can now use a custom
queryIDoption to override the generated queryID normally returned from the function, eg.sithuhub commentedon Nov 12, 2019
#28
Merge pull request #4 from tannerlinsley/master
Merge pull request TanStack#4 from lukesmurray/luke/fix-linting
Merge pull request #4 from Oungseik/svelte-5-experimental
Merge pull request TanStack#4 from pzich/pzich/fix-typo