Skip to content

refactor: use renderable guards for input adornments - #203

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

refactor: use renderable guards for input adornments#203
yoyo837 merged 1 commit into
react-component:masterfrom
QDyanbing:refactor-renderable-guards

Conversation

@QDyanbing

@QDyanbing QDyanbing commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

说明

  • 使用 isReactRenderable 统一判断 prefix、suffix、addon 和 clear icon 是否需要渲染
  • 支持数字 0 等有效 React 内容,并保持相关布局 class 与节点判断一致
  • @rc-component/util 的最低版本提升到首次提供该 helper 的 ^1.13.0

验证

  • npm run tsc
  • npm run lint
  • npm test -- tests/BaseInput.test.tsx tests/index.test.tsx --runInBand

Summary by CodeRabbit

  • Bug 修复
    • 优化输入框前缀、后缀及前后置内容的渲染判断,确保可渲染的 React 节点能够正确显示。
    • 改进清除图标的显示判断,提升相关配置下的渲染准确性。

@vercel

vercel Bot commented Sep 2, 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 2, 2026

Copy link
Copy Markdown

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: d13b8016-d6d0-4792-8ee0-2e05b4844be2

📥 Commits

Reviewing files that changed from the base of the PR and between 52086bb and 59517fe.

📒 Files selected for processing (3)
  • package.json
  • src/BaseInput.tsx
  • src/utils/commonUtils.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

本次变更将节点渲染判断统一为 isReactRenderable,覆盖 BaseInputhasAddonhasPrefixSuffix。同时将 @rc-component/util 更新至 ^1.13.0

Changes

可渲染节点判断

Layer / File(s) Summary
工具函数可渲染判断
src/utils/commonUtils.ts, package.json
hasAddonhasPrefixSuffix 使用 isReactRenderable 判断节点,并显式转换 allowClear。运行时依赖更新至 @rc-component/util ^1.13.0
BaseInput 渲染条件
src/BaseInput.tsx
清除图标、前缀、后缀、addonBeforeaddonAfter 的渲染及相关类名条件使用 isReactRenderable

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

Merge Risk: ⚪ Minimal · up to 59517

Adornment values such as numeric 0 will render consistently while existing layout behavior stays aligned with rendered nodes. No actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: afc163

Poem

小兔拿起渲染锤,
节点真假分得明。
前缀后缀齐检查,
清除图标不漏行。
工具版本同步升,
代码轻快过春风。

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 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 标题准确概括了主要变更:使用可渲染性判断来处理输入组件的前缀、后缀、附加内容和清除图标。标题简洁且具体。
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 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 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 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.36%. Comparing base (52086bb) to head (59517fe).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #203      +/-   ##
==========================================
+ Coverage   98.34%   98.36%   +0.01%     
==========================================
  Files          11       11              
  Lines         423      428       +5     
  Branches      137      134       -3     
==========================================
+ Hits          416      421       +5     
  Misses          7        7              

☔ 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 507a041 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