Skip to content

Add an ESLint Rule to Prevent Hardcoded Cache Keys #7344

Closed Answered by TkDodo
vanenshi asked this question in Ideas
Discussion options

You must be logged in to vote

sure, but just because you export a constant called currentUserQueryKey also doesn't guarantee that it will be used everywhere. Nothing is stopping you from calling queryClient.invalidateQueries(['foo', 'bar']) and then have you wondering why the users aren't invalidated after that call. This is nothing a lint rule can solve. Libraries built on top of react-query, like trpc or zodios on the other hand, can solve and have solved this problem.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@vanenshi
Comment options

@TkDodo
Comment options

Answer selected by vanenshi
@vanenshi
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants