Repository navigation
fix: commit a RangePicker range when only one field was typed and the picker is left - #1031
kfylaktopoulos wants to merge 1 commit into
Conversation
|
@kfylaktopoulos 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. Walkthrough范围选择器的提交函数现在返回提交校验结果。无需触发变更时,提交函数返回 Changes范围选择器提交流程
Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Possibly related PRs
Suggested reviewers: Merge Risk:
|
|
cc @kliakos — this is the upstream fix for the RangePicker commit issue we patched locally (typed edit of one field lost on blur). |
Problem: in a
RangePickerwithoutneedConfirm, typing a new start or end date into a filled range and then leaving the picker (blur / click outside) never firesonChange. The input shows the new date, but the value (and anyForm) keeps the old one.Steps (antd
DatePicker.RangePickerin aForm, or@rc-component/pickerdirectly):[2000-01-01, 2000-01-05].2000-01-09.Expected:
onChangewith['2000-01-01', '2000-01-09']. Actual: noonChange; the form still submits2000-01-05.Why:
useRangeValueChangeonly emits the final change once every field took part in the interaction. A popup close after input only part-submits the current field and moves the expected index to the other field, but focus has already left the picker, so that visit never comes and the round is dropped.Fix: without
needConfirm, a popup close that follows input finishes the round when every other field already has a value or allows empty (canFinishEarly). If that final submit is rejected (disabledDate, empty required field), all temporary values are reset so the input doesn't keep text the value never got.FlushSubmitnow returns whether the submit passed, for that check.Unchanged on purpose:
auto opentests inrange.spec.tsx).needConfirm, Escape, panel selection and Tab keep their current flow.Tests:
tests/range-commit.spec.tsx(8 cases). 5 fail onmasterand pass with the fix (typed start, typed end,allowEmptyend,disabledDaterejection then a valid edit,order={false}); 3 pass on both and guard Enter, Escape and the required-empty case. The full suite has the same 11 failures as onmasterin this environment (classNames/time step inpicker.spec.tsx, panelRender/dateRender snapshots inrange.spec.tsx).Related: #1020 (rejected value on popup close) touches the same path for a different case.
Summary by CodeRabbit