-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Custom cache key #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
So instead of relying on the idempotency of the |
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. |
Though not fully documented yet. You can now use a custom // You must memoize the query function. useQuery will still detect changes to the
// `query` reference and try to refetch if it changes
const queryFn = React.useCallback(() => axios.get('/todos'), [])
// Then just pass a `queryID` string:
useQuery(queryFn, { queryID: 'fetchTodos' }) |
fix lint and typecheck errors
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
The text was updated successfully, but these errors were encountered: