Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure consistency between controlled and uncontrolled logic #685

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Yuiai01
Copy link
Contributor

@Yuiai01 Yuiai01 commented Oct 9, 2023

close ant-design/ant-design#44992 (comment)
问题背景:
在该 PR 之前如果 RangePicker 的 open 设置为 true,因为没有初始化 nextActiveIndex,所以根据 afferentOpen 和 index 等判断 nextActiveIndex,但是这样会导致 nextActiveIndex 永远不会是 null,因此永远不会触发关闭时间选择面板的逻辑(不会触发 onOpenChange)。
该 PR 的作用是当 RangePicker 处于选择完日期也就是可关闭状态时触发关闭选择时间面板的逻辑(会触发 onOpenChange),当 open 受控变成 false 时,需要将 focus 动画取消,并且由于 mergedActivePickerIndex 会先改变因此需要改回去。

@vercel
Copy link

vercel bot commented Oct 9, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
picker ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2023 2:21pm

@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

Merging #685 (f6b2569) into master (f6c6803) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head f6b2569 differs from pull request most recent head 934d722. Consider uploading reports for the commit 934d722 to get more accurate results

@@           Coverage Diff           @@
##           master     #685   +/-   ##
=======================================
  Coverage   98.94%   98.94%           
=======================================
  Files          56       56           
  Lines        2457     2466    +9     
  Branches      734      737    +3     
=======================================
+ Hits         2431     2440    +9     
  Misses         24       24           
  Partials        2        2           
Files Coverage Δ
src/hooks/useRangeOpen.ts 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rangepicker open属性受控下 行为有问题
1 participant