Repository navigation
Conversation
A field submitted by closing the popup kept its temporary calendar value when the submit was rejected by disabledDate, so the selector displayed a value the committed value never accepted. Blur and Enter also behaved differently for the same input, since Enter's close event arrives one step later and lands on the `currentIndex === null` branch. Let `flushSubmit` report whether the flushed value was accepted, and reset the temporary value inside `submitField` when it was rejected. Consumers that explicitly ask for the typed text to survive blur (`preserveInvalidOnBlur`) keep the previous behaviour.
|
@Ye-YiChen 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
Walkthrough单日期和范围日期选择器现可获知字段提交的校验结果。提交被拒绝时,值变更流程默认重置临时值;启用 Changes被拒绝日期的失焦处理
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to With this change, a date rejected by Pre-merge checks |
|
Fixes #1018
Problem: a date rejected by
disabledDateis not reverted when the input is blurred (the popup closes) — the input keeps showing it while the committedvaluewas never updated. Pressing Enter for the same input works.Why:
resolveActiondecides the action before the submit happens, so it cannot know the submit will be rejected. On the blur path the popup close is what triggers the submit; after the rejectionreset()only clears the bookkeeping and leaves the temporary value behind, andswitchNextis a submit action, so nothing ever reachesresetValue. Enter only works by accident: its close event arrives one step later and lands on thecurrentIndex === nullbranch.Changes
flushSubmitnow reports the submit result (boolean | void), andsubmitFielddiscards the temporary value when it comes backfalse— equivalent to runningresetAllon the spot.preserveInvalidOnBlurkeeps the previous behaviour by skipping that discard (the default is to discard).Tests in
tests/blur.spec.tsx: rejected → reverted, rejected withpreserveInvalidOnBlur→ kept, accepted → committed.One thing to confirm: Does the
preserveInvalidOnBlurprop affectdisabledDate?