fix(reactivity): preserve watch callback return value when wrapped for once: true#14902
fix(reactivity): preserve watch callback return value when wrapped for once: true#14902ackwell wants to merge 1 commit into
once: true#14902Conversation
|
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 |
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