fix(reactivity): preserve watch callback return value when wrapped for once: true#14902
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR fixes the watch function to return the original callback's result when ChangesWatch callback behavior with once mode
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
|
/ecosystem-ci run |
|
📝 Ran ecosystem CI: Open
|
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [vue](https://vuejs.org/) ([source](https://github.com/vuejs/core)) | [`3.5.35` → `3.5.38`](https://renovatebot.com/diffs/npm/vue/3.5.35/3.5.38) |  |  | --- ### Release Notes <details> <summary>vuejs/core (vue)</summary> ### [`v3.5.38`](https://github.com/vuejs/core/blob/HEAD/CHANGELOG.md#3538-2026-06-11) [Compare Source](vuejs/core@v3.5.37...v3.5.38) ### [`v3.5.37`](https://github.com/vuejs/core/blob/HEAD/CHANGELOG.md#3537-2026-06-11) [Compare Source](vuejs/core@v3.5.36...v3.5.37) ### [`v3.5.36`](https://github.com/vuejs/core/blob/HEAD/CHANGELOG.md#3536-2026-06-11) [Compare Source](vuejs/core@v3.5.35...v3.5.36) ##### Bug Fixes - **compiler-core:** avoid crash on CDATA at the document root ([#​14916](vuejs/core#14916)) ([0ea17e2](vuejs/core@0ea17e2)) - **compiler-core:** prefix dynamic keys on v-memo elements ([#​14922](vuejs/core#14922)) ([68e978e](vuejs/core@68e978e)), closes [#​14920](vuejs/core#14920) - **compiler-sfc:** handle vue-ignore on leading intersection/union type ([#​14950](vuejs/core#14950)) ([0dcd225](vuejs/core@0dcd225)), closes [#​12254](vuejs/core#12254) - **compiler-sfc:** respect var hoisting in props destructure ([48ad452](vuejs/core@48ad452)) - **reactivity:** preserve watch callback return value when wrapped for `once: true` ([#​14902](vuejs/core#14902)) ([450a8a8](vuejs/core@450a8a8)) - **runtime-core:** add dev warning for silent catch in compat mode and fix test description typo ([#​14891](vuejs/core#14891)) ([db3e117](vuejs/core@db3e117)) - **runtime-core:** force model update when reverted before sync ([#​14897](vuejs/core#14897)) ([7f76378](vuejs/core@7f76378)), closes [#​13524](vuejs/core#13524) - **runtime-core:** skip async component callbacks after unmount ([#​14911](vuejs/core#14911)) ([5300ead](vuejs/core@5300ead)) - **transition:** avoid move transition for hidden v-show group children ([#​14895](vuejs/core#14895)) ([c11f6ee](vuejs/core@c11f6ee)), closes [#​14894](vuejs/core#14894) - **watch:** trigger immediate callback for empty sources ([#​14914](vuejs/core#14914)) ([1f2ca7e](vuejs/core@1f2ca7e)), closes [#​14898](vuejs/core#14898) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMTcuMSIsInVwZGF0ZWRJblZlciI6IjQzLjIxNy4xIiwidGFyZ2V0QnJhbmNoIjoiZXZvbHV0aW9ucy1wb3N0LTEuMS44IiwibGFiZWxzIjpbXX0=--> Reviewed-on: https://codeberg.org/leuwen-lc/rhdemo/pulls/167
watchcallbacks are executed viacallWithAsyncErrorHandling, which inspects the return value of the callback to determine if promise rejection handling is required.when passing
once: truetowatch's options, the callback is wrapped to add thewatchHandlecall after the first execution - in the process, silently dropping any returned promises.this pr is just a small tweak + test to preserve the original callback's result, returning it from the new wrapped method.
Summary by CodeRabbit
Release Notes
watch()function to properly return callback values when theonceoption is used