Tag collisions — two tags with the same serialized value
Tags are matched by their serialized value, not by where they were defined. Duplicate values silently over-invalidate.
normalizeTag(["list"]) and normalizeTag(["list"]) produce the identical string '["list"]'. If two unrelated domains use the same raw array, invalidating one will also invalidate the other.
// teams.ts
const teamTags = defineTags({
list: () => ["list"], // ❌ tag value is just ["list"]
})
// projects.ts
const projectTags = defineTags({
list: () => ["list"], // ❌ identical tag value!
})
// Invalidating teamTags.list() also invalidates projectTags.list()
// because both serialize to the same string: '["list"]'Rule of thumb: always start the first element of a tag array with a domain prefix unique to that entity type ("todos", "projects", "billing-invoices"). Using defineTags() with one tree per domain makes collisions structurally impossible as long as keys differ at the root.