--- title: watchEffect Only Tracks Dependencies Before First Await impact: HIGH impactDescription: Dependencies accessed after await are not tracked, causing watchers to miss reactive changes type: capability tags: [vue3, watchEffect, watchers, async, await, dependency-tracking] --- # watchEffect Only Tracks Dependencies Before First Await **Impact: HIGH** - `watchEffect` automatically tracks reactive dependencies, but only during synchronous execution. Any reactive properties accessed after the first `await` statement will NOT be tracked, and changes to them won't trigger the watcher. For async operations, either access all dependencies before the await, or use `watch` with explicit dependencies. ## Task Checklist - [ ] Access all reactive dependencies BEFORE the first await in watchEffect - [ ] Use `watch` with explicit source when async tracking is needed - [ ] Store reactive values in local variables before await - [ ] Be aware that dependencies after await are invisible to Vue **Incorrect:** ```vue ``` **Correct:** ```vue ``` ## Pattern: Extract Dependencies First ```vue ``` ## When to Use watch Instead ```vue ``` ## Debugging Untracked Dependencies ```vue ``` ## Reference - [Vue.js Watchers - watchEffect](https://vuejs.org/guide/essentials/watchers.html#watcheffect) - [Vue.js API - watchEffect](https://vuejs.org/api/reactivity-core.html#watcheffect)