Vue · VUE0005

Watch destructured props with a getter

Finds Vue reactivity code that can be written with a clearer framework-supported pattern.
VUE0005vite-doctor/vuereactivityerrorAuto-fix

Run this rule

pnpm vite-doctor . --framework vue --rules vue/reactivity/defineprops-watch-getter

Why it matters

Effects that outlive their component create leaks and stale updates. Register cleanup where Vue or VueUse can dispose it automatically.

Use the Vue-supported defineProps watch getter pattern instead.

Example

Watch props with getters

Before

<script setup lang="ts">
const props = defineProps<{ id: string }>()
watch(props.id, loadUser)
</script>

After

<script setup lang="ts">
const props = defineProps<{ id: string }>()
watch(() => props.id, loadUser)
</script>
Copyright © 2026