Skip to content

fix: preserve zero-valued suffix content - #205

Open
QDyanbing wants to merge 1 commit into
react-component:masterfrom
QDyanbing:fix-react-node-guards
Open

QDyanbing wants to merge 1 commit into
react-component:masterfrom
QDyanbing:fix-react-node-guards

Conversation

@QDyanbing

@QDyanbing QDyanbing commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

说明

  • 补齐 Input 的 suffix 渲染与计数后缀样式判断,suffix={0} 不再被忽略。
  • 使用共享 isReactRenderable,保留既有空后缀行为,并补充回归测试。

验证

  • npm test -- --runInBand(132 项通过)
  • npm run tsc
  • 改动源码 ESLint 检查通过。

关联 ant-design/ant-design#59193

Summary by CodeRabbit

  • Bug Fixes

    • 输入框后缀现在能正确显示数字 0;启用计数显示时,也会应用相应的计数样式。
    • null、undefined、false 和空字符串仍不会显示后缀区域。
  • Tests

    • 补充了后缀渲染相关测试。

@vercel

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

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 11a9ad15-969c-4720-9f9d-b81a726a054d

📥 Commits

Reviewing files that changed from the base of the PR and between 507a041 and 7a70001.

📒 Files selected for processing (2)
  • src/Input.tsx
  • tests/renderability.test.tsx

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


Walkthrough

Input 现在使用 isReactRenderable 判断 suffix 是否可渲染,并据此生成后缀区域和设置计数样式标记。新增测试覆盖可渲染的 0,以及不会渲染后缀元素的值。

Changes

后缀渲染

Layer / File(s) Summary
后缀渲染判断与验证
src/Input.tsx, tests/renderability.test.tsx
Input 使用 isReactRenderable 判断是否生成后缀区域,并据此设置 show-count-has-suffix 类。测试覆盖 suffix 为 0、null、undefined、false 和空字符串时的渲染结果。

Priority: ⬇️ Low

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 7a700

Suffix zero is rendered while the listed non-renderable values remain omitted. No concrete merge-blocking issue was identified; the change appears ready subject to normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题“fix: preserve zero-valued suffix content”准确概括了主要变更:修复 suffix={0} 内容被忽略的问题。标题简洁、明确,并与代码和测试变更一致。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
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.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR

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

小兔看见零也能现身,
蹦过后缀,数值亮晶晶。
null 和空白安静退场,
测试逐个确认渲染模样。
新逻辑落定,萝卜香!

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

@codecov

codecov Bot commented Sep 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.36%. Comparing base (507a041) to head (7a70001).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #205   +/-   ##
=======================================
  Coverage   98.36%   98.36%           
=======================================
  Files          11       11           
  Lines         428      428           
  Branches      134      134           
=======================================
  Hits          421      421           
  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.

This branch has not been deployed

No deployments
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.

1 participant