Skip to content

refactor: use shared renderability guards - #1009

Merged
yoyo837 merged 1 commit into
react-component:masterfrom
QDyanbing:refactor-renderable-guards
Sep 3, 2026
Merged

refactor: use shared renderability guards#1009
yoyo837 merged 1 commit into
react-component:masterfrom
QDyanbing:refactor-renderable-guards

Conversation

@QDyanbing

@QDyanbing QDyanbing commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

说明

  • 使用 isReactRenderable 统一判断 footer、prefix、suffix icon 和 clear icon 等 ReactNode 是否需要渲染
  • 使用 isNonNullable 替换面板与时间选择逻辑中的本地非空判断
  • @rc-component/util 的最低版本提升到首次提供这些 helper 的 ^1.13.0

验证

  • npm run tsc
  • npm run lint
  • npm test -- tests/components.spec.tsx tests/panel.spec.tsx tests/picker.spec.tsx tests/range.spec.tsx --runInBand

Summary by CodeRabbit

  • Bug 修复
    • 优化日期选择器中图标、前缀、额外页脚及清除按钮的渲染判断。
    • 对不可渲染的配置值进行正确处理,避免出现空白区域或异常内容。
    • 当自定义清除图标不可用时,自动回退至默认清除按钮。
    • 改进面板表头及时间值为空时的显示逻辑。

@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

@QDyanbing is attempting to deploy a commit to the afc163's projects Team on Vercel.

A member of the Team first needs to authorize it.

@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: 3f069a04-adf8-4ec5-97d0-16030ab0a05f

📥 Commits

Reviewing files that changed from the base of the PR and between 16084b6 and 08207d0.

📒 Files selected for processing (9)
  • package.json
  • src/PickerInput/Popup/Footer.tsx
  • src/PickerInput/Selector/Icon.tsx
  • src/PickerInput/Selector/RangeSelector.tsx
  • src/PickerInput/Selector/SingleSelector/index.tsx
  • src/PickerInput/Selector/hooks/useClearIcon.tsx
  • src/PickerPanel/PanelBody.tsx
  • src/PickerPanel/TimePanel/TimePanelBody/index.tsx
  • src/utils/getClearIcon.tsx

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


Walkthrough

本次变更升级 @rc-component/util,并将清除图标、前缀、页脚内容及面板节点的判断改为使用共享可渲染性或非空工具。

Changes

React 节点可渲染性统一

Layer / File(s) Summary
清除图标解析与选择器接入
package.json, src/utils/getClearIcon.tsx, src/PickerInput/Selector/hooks/useClearIcon.tsx, src/PickerInput/Selector/SingleSelector/index.tsx, src/PickerInput/Selector/RangeSelector.tsx
依赖版本升级至 ^1.13.0。清除图标解析、开发警告和清除按钮显示条件改用 isReactRenderable
选择器与页脚渲染判断
src/PickerInput/Selector/Icon.tsx, src/PickerInput/Selector/RangeSelector.tsx, src/PickerInput/Selector/SingleSelector/index.tsx, src/PickerInput/Popup/Footer.tsx
图标、前缀和额外页脚内容仅在可渲染时输出。
面板非空判断
src/PickerPanel/PanelBody.tsx, src/PickerPanel/TimePanel/TimePanelBody/index.tsx
表头判断和时间模板逻辑改用 isNonNullable

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 08207

This change standardizes picker renderability checks and updates the utility dependency that supplies them. Non-renderable custom nodes are omitted or fall back to the existing clear control, while the panel non-null checks retain their prior behavior; no current merge-blocking risk is identified.

Suggested reviewers: zombiej

Poem

小兔挥爪更新依赖包
可渲染节点排好队
清除图标不再乱跳舞
前缀页脚按规则出现
面板时间稳稳向前走

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 8 files. (1 skipped: 1… 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 标题“refactor: use shared renderability guards”准确概括了本次将渲染性判断统一为共享工具函数的主要变更,内容简洁且明确。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 8 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@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 (16084b6) to head (08207d0).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1009   +/-   ##
=======================================
  Coverage   98.87%   98.88%           
=======================================
  Files          68       68           
  Lines        2857     2859    +2     
  Branches      815      811    -4     
=======================================
+ Hits         2825     2827    +2     
  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.

@yoyo837 yoyo837 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the renderability semantics, helper selection, dependency floor, existing feedback, and completed CI results. The implementation looks correct. The Vercel failure is limited to team deployment authorization and is not a code or build failure.

@yoyo837
yoyo837 merged commit f367642 into react-component:master Sep 3, 2026
9 of 10 checks passed
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.

2 participants