Vue · Watchers
vite-doctor/vuewatcherserrorSuggestion
Why it happens
Effects that outlive their component create leaks and stale updates. Register cleanup where Vue or VueUse can dispose it automatically.
Fix
Remove onwatchercleanup after await, or move it to the Vue runtime/API that owns that behavior.
Example
Register watcher cleanup before await
Before
<script setup lang="ts">
watch(id, async () => {
await loadUser()
onWatcherCleanup(cancelLoad)
})
</script>
After
<script setup lang="ts">
watch(id, async () => {
onWatcherCleanup(cancelLoad)
await loadUser()
})
</script>
Verify the fix
Run only this rule after editing so the report stays focused on the diagnostic you are closing:
pnpm vite-doctor . --framework vue --rules vue/watch/no-onwatchercleanup-after-await