fix: prevent stale normalization after controlled value updates - #755
fix: prevent stale normalization after controlled value updates#755nikzanda wants to merge 1 commit into
Conversation
|
@nikzanda is attempting to deploy a commit to the afc163's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. Walkthrough受控值变化时, Changes输入规范化
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to Controlled value updates no longer allow stale input normalization to overwrite the displayed value or emit an outdated change. The affected behaviors are covered across controlled and uncontrolled usage, and no current merge-blocking risk remains. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #755 +/- ##
==========================================
+ Coverage 96.14% 96.17% +0.03%
==========================================
Files 6 6
Lines 363 366 +3
Branches 102 104 +2
==========================================
+ Hits 349 352 +3
Misses 14 14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Follow-up to the discussion in #751.
Typing
1。schedules normalization to1.. If the controlledvaluechanges to2before that callback runs, the stale normalization can overwrite the displayed value and emit an outdatedonChange.This fix invalidates pending normalization when a controlled update replaces the typed value, while preserving normal behavior when the parent echoes the value received through
onChange.Includes regression tests for controlled updates, zero and empty values, stale callbacks, and continued normalization in controlled and uncontrolled modes.
Summary by CodeRabbit
onChange和onInput事件触发顺序与时机。