From 563008af28177c17f5acd86ec01f7a33d58f2f8b Mon Sep 17 00:00:00 2001 From: Sumit Date: Wed, 18 Nov 2026 09:45:39 +0530 Subject: [PATCH] docs: clarify old values for immediate watchers --- src/api/reactivity-core.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/reactivity-core.md b/src/api/reactivity-core.md index 61195ed0f2..e0f73a0cb6 100644 --- a/src/api/reactivity-core.md +++ b/src/api/reactivity-core.md @@ -418,11 +418,11 @@ Watches one or more reactive data sources and invokes a callback function when t The second argument is the callback that will be called when the source changes. The callback receives three arguments: the new value, the old value, and a function for registering a side effect cleanup callback. The cleanup callback will be called right before the next time the effect is re-run, and can be used to clean up invalidated side effects, e.g. a pending async request. - When watching multiple sources, the callback receives two arrays containing new / old values corresponding to the source array. + When watching multiple sources, the callback receives two arrays containing the new and old values in source order. The third optional argument is an options object that supports the following options: - - **`immediate`**: trigger the callback immediately on watcher creation. Old value will be `undefined` on the first call. + - **`immediate`**: trigger the callback immediately on watcher creation. On the first call, the old value is `undefined` for a single source or an empty array for multiple sources. - **`deep`**: force deep traversal of the source if it is an object, so that the callback fires on deep mutations. In 3.5+, this can also be a number indicating the max traversal depth. See [Deep Watchers](/guide/essentials/watchers#deep-watchers). - **`flush`**: adjust the callback's flush timing. See [Callback Flush Timing](/guide/essentials/watchers#callback-flush-timing) and [`watchEffect()`](/api/reactivity-core#watcheffect). - **`onTrack / onTrigger`**: debug the watcher's dependencies. See [Watcher Debugging](/guide/extras/reactivity-in-depth#watcher-debugging).