fix(reactivity): avoid triggering effects when set fails#14964
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)
📝 WalkthroughWalkthrough
ChangesReactive trigger guard fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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: |
This fixes a small reactivity edge case where
MutableReactiveHandler.settriggered effects even when the underlyingReflect.setoperation failed.For example, assigning to a non-writable property through a reactive proxy throws and leaves the value unchanged, but the dependent effect was still re-run.
The handler now only triggers
ADD/SETnotifications whenReflect.setsucceeds.Tests added:
Validation:
pnpm exec vitest run packages/reactivity/__tests__/reactive.spec.ts -t "failed set operation should not trigger effects"pnpm exec vitest run packages/reactivitypnpm exec prettier --check packages/reactivity/src/baseHandlers.ts packages/reactivity/__tests__/reactive.spec.tspnpm exec eslint packages/reactivity/src/baseHandlers.ts packages/reactivity/__tests__/reactive.spec.tspnpm checkSummary by CodeRabbit
Bug Fixes
Tests