Chapter 1 — Basics
Master the fundamentals of tag-based invalidation
Start here. Learn how to tag queries, invalidate from the server, and watch your data refresh automatically. No boilerplate, no missed queries, no stale data.
The Demos
Tagged Query
BeginnerYour first tagged query
Attach meta.tags to any useQuery call and watch it refresh automatically when the server invalidates.
meta.tagsappTags.todos.list()withTags Helper
BeginnerZero-boilerplate tagging
Wrap your queryFn with withTags() and eliminate the meta object entirely.
withTags()queryFnMutation Patterns
BeginnerThree ways to invalidate
Compare onSuccess, server-side invalidation, and optimistic patterns side by side.
useMutationinvalidateTagsRoute Loaders
BeginnerLoaders refresh too
TanStack Router loaders that use ensureQueryData participate in tag invalidation automatically.
ensureQueryDataloaderGroup Invalidation
BeginnerOne tag, many queries
Invalidate a parent tag and every child query refreshes — no listing required.
appTags.todos()group tagsSelective Invalidation
BeginnerThe visual matrix
See exactly which queries match which tags in a live grid.
tag matchingselectivity