fix(watch): trigger immediate callback for empty sources (fix #14898)#14914
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds ChangesImmediate callback execution for empty array watch
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Suggested reviewers
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 |
@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: |
Size ReportBundles
Usages
|
|
/ecosystem-ci run |
|
📝 Ran ecosystem CI: Open
|
Summary
Fixes #14898.
watch([], cb, { immediate: true })Testing
pnpm test --run packages/runtime-core/__tests__/apiWatch.spec.ts -t "watching empty multiple sources with immediate: true"failed withexpected "vi.fn()" to be called 1 times, but got 0 timespnpm test --run packages/runtime-core/__tests__/apiWatch.spec.ts -t "watching empty multiple sources with immediate: true"pnpm test --run packages/runtime-core/__tests__/apiWatch.spec.tspnpm test --run packages/runtime-core/__tests__/apiWatch.spec.ts packages/reactivity/__tests__/watch.spec.tspnpm exec prettier --check packages/reactivity/src/watch.ts packages/runtime-core/__tests__/apiWatch.spec.tspnpm exec eslint packages/reactivity/src/watch.ts packages/runtime-core/__tests__/apiWatch.spec.ts --max-warnings=0git diff --checkpnpm checkAI-assisted, reviewed locally.
Summary by CodeRabbit
immediateoption so callbacks run exactly once on setup (including when watching arrays), ensuring consistent and reliable initial callback behavior.