Smart Cache Invalidation

useActionMutation + tags — write once, every affected query refetches

The problem: after you add, toggle, or delete a task, the list and the stats panel both go stale. Manually wiring a refetch after every mutation is error-prone and easy to forget.

The fix: both queries register the 'tasks' tag. Each mutation declares invalidates: ['tasks'], so a successful write auto-refetches every query under that tag — no manual plumbing.

Stats

Total: 3Done: 1Pending: 2

Add a task

Tasks

Ship nuxt-actions v1.4.0
Write real-world demos
Update the documentation

How it works

import { listTasks, taskStats, addTask } from '#actions'

// Two queries share one tag
const { data: list } = useActionQuery(listTasks, undefined, { tags: ['tasks'] })
const { data: stats } = useActionQuery(taskStats, undefined, { tags: ['tasks'] })

// One mutation invalidates the tag — both queries refetch
const add = useActionMutation(addTask, { invalidates: ['tasks'] })
await add.execute({ title })