Skip to content

fix: preserve pending range selection on hover - #1010

Open
zombieJ wants to merge 1 commit into
masterfrom
codex/fix-range-picker-hover-selection
Open

fix: preserve pending range selection on hover#1010
zombieJ wants to merge 1 commit into
masterfrom
codex/fix-range-picker-hover-selection

Conversation

@zombieJ

@zombieJ zombieJ commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

  • keep a modified RangePicker endpoint selected while its confirmation is pending
  • render the hovered cell with an independent hover state while retaining the input preview
  • preserve existing range and preset previews and add regression coverage

Validation

  • ut test --runInBand: 15 suites passed, 469 tests passed, 2 skipped
  • ut lint:tsc
  • ut lint: 0 errors, 16 existing hook warnings
  • focused Prettier check and git diff --check

Fixes ant-design/ant-design#59070.

AI assistance disclosure: Codex was used to trace the hover state flow, add the regression test, implement the fix, run validation, and draft this description.

Summary by CodeRabbit

  • 功能优化
    • 优化范围选择器在带时间选择时的悬停预览体验。
    • 选择开始日期后悬停结束日期时,已确认的日历状态保持不变,并正确显示当前悬停日期。
    • 改善范围选择过程中单元格的高亮状态,区分已选范围与悬停预览。

@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
picker Ready Ready Preview Sep 3, 2026 4:02am UTC

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 04bb472.

@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 219e9559-c560-43e4-b103-5e19fd8858bf

📥 Commits

Reviewing files that changed from the base of the PR and between f367642 and 04bb472.

📒 Files selected for processing (4)
  • src/PickerInput/Popup/PopupPanel.tsx
  • src/PickerInput/RangePicker.tsx
  • src/PickerInput/hooks/useRangeValueChange.ts
  • tests/range.spec.tsx

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


Walkthrough

RangePicker 新增当前字段修改状态跟踪。确认模式下,面板分离已提交日历值和单元格悬停值。测试覆盖 showTime 范围选择的悬停样式。

Changes

范围选择悬停状态

Layer / File(s) Summary
跟踪当前字段修改状态
src/PickerInput/hooks/useRangeValueChange.ts
useRangeValueChange 返回 currentFieldModified,并通过当前字段的 modified 标记计算该值。
选择面板悬停值
src/PickerInput/RangePicker.tsx
RangePicker 根据确认模式、当前字段修改状态和悬停来源,选择面板日历值,并提取当前字段的悬停值。
渲染并验证悬停状态
src/PickerInput/Popup/PopupPanel.tsx, tests/range.spec.tsx
PopupPanel 在范围模式下使用 cellHoverValue。测试验证已选开始日期保留范围起点样式,悬停日期使用悬停样式。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 04bb4

This change preserves the pending selected endpoint in RangePicker while rendering a separately hovered date, with regression coverage for the showTime flow. The targeted behavior and validation are complete, with no remaining merge-readiness risk identified.

Sequence Diagram(s)

sequenceDiagram
  participant RangePicker
  participant useRangeValueChange
  participant PopupPanel
  RangePicker->>useRangeValueChange: 读取 currentFieldModified
  RangePicker->>PopupPanel: 传递日历值和 cellHoverValue
  PopupPanel->>PopupPanel: 在范围模式使用 cellHoverValue 渲染悬停状态
Loading

Suggested reviewers: qdyanbing

Poem

小兔拎着日期篮,
开始日期稳稳站。
悬停月光落新格,
旧的高亮不走散。
PopupPanel 轻轻画,
范围状态更清晰。

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了 RangePicker 在悬停时保留待确认范围选择的主要修复,内容简洁且与变更一致。
Linked Issues check ✅ Passed 变更直接解决 issue #59070:在启用 showTime 时,选择一个日期后悬停其他日期,已选日期继续保留选中样式,悬停日期显示独立的悬停样式。新增测试覆盖该场景。
Out of Scope Changes check ✅ Passed 所有变更均围绕 RangePicker 悬停状态修复,包括面板属性、范围值状态、调用逻辑和回归测试。未发现与 issue #59070 无关的代码变更。
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-range-picker-hover-selection

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

❌ Deploy failed

PR preview ❌ Failed ❌ Failed
🔗 Preview https://react-component-picker-preview-pr-1010.surge.sh (may be unavailable)
📝 Commit04bb472
🪵 LogsView logs
📋 Build log (last lines)
npm error
npm error Could not resolve dependency:
npm error peer eslint@"^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7" from eslint-plugin-react@7.37.5
npm error node_modules/eslint-plugin-react
npm error   dev eslint-plugin-react@"^7.37.5" from the root project
npm error   eslint-plugin-react@"^7.32.2" from @umijs/fabric@4.0.1
npm error   node_modules/@umijs/fabric
npm error     @umijs/fabric@"^4.0.0" from rc-test@7.1.3
npm error     node_modules/rc-test
npm error       dev rc-test@"^7.1.3" from the root project
npm error
npm error Conflicting peer dependency: eslint@9.39.5
npm error node_modules/eslint
npm error   peer eslint@"^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7" from eslint-plugin-react@7.37.5
npm error   node_modules/eslint-plugin-react
npm error     dev eslint-plugin-react@"^7.37.5" from the root project
npm error     eslint-plugin-react@"^7.32.2" from @umijs/fabric@4.0.1
npm error     node_modules/@umijs/fabric
npm error       @umijs/fabric@"^4.0.0" from rc-test@7.1.3
npm error       node_modules/rc-test
npm error         dev rc-test@"^7.1.3" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /home/runner/.npm/_logs/2026-09-03T04_03_04_392Z-eresolve-report.txt
npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2026-09-03T04_03_04_392Z-debug-0.log

🤖 Powered by surge-preview

@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.88%. Comparing base (f367642) to head (04bb472).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1010   +/-   ##
=======================================
  Coverage   98.88%   98.88%           
=======================================
  Files          68       68           
  Lines        2859     2866    +7     
  Branches      811      791   -20     
=======================================
+ Hits         2827     2834    +7     
  Misses         29       29           
  Partials        3        3           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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 开启 showTime 时,选定一个日期后会有选中样式,鼠标再 hover 到其它日期时该样式丢失

1 participant