Replies: 2 comments 10 replies
-
Hi @digistaal, does the query key design pose any challenge with invalidation? The idea is you could invalidate on ANY level, but obviously it's not quite the same as the links you shared. A better starting point would be to look at issues you're facing and go from there? |
Beta Was this translation helpful? Give feedback.
5 replies
-
You can use the queryKey generator functions to generate the query keys to invalidate |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi community,
I noticed that the queryKey that's being generated for the @TanStack/Query plugin is an array with one object as an entry. This object contains an id, baseUrl and some information about params. I was wondering why these generated queryKeys don't follow the best practise of the identifier of your query being spread out as an hierarchal array instead of an object. Currently because of this design, invalidation of the queries works a bit different than the package designed it to. Normally queries can be invalidated on a higher level by only providing the first queryKey array's entry and can specify a more specific query by supplying more entries of this queryKey.
See the @TanStack/Query docs and this blog regarding best practises for more information.
Really curious about the reasoning behind this, please let me know!
Beta Was this translation helpful? Give feedback.
All reactions