Query invalidation
Marking cached queries stale after a write so they refetch, instead of editing the cache by hand. invalidateQueries with a key prefix refreshes every matching query that is on screen.
Minimal example
void queryClient.invalidateQueries({ queryKey: ["orders"] });Learn this concept
Lesson 4.8 · TanStack Query cachingUsed in exercises
Exercise 4.16 · Cart screen Exercise 4.17 · Orders tab and order detail screensPrerequisite conceptsQuery key