Skip to content

fix: preserve zero-valued step content and icon styles - #399

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

说明

  • 保留 itemRender 返回的 0,避免将有效内容替换成 null。
  • icon={0} 正确标记自定义图标样式,补充零值与空值回归测试。

验证

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

关联 ant-design/ant-design#59193

Summary by CodeRabbit

  • Bug 修复
    • 优化步骤项对自定义图标和渲染内容的处理,确保数字 0 可以正常显示;无效或空内容不会生成步骤内容。

@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: 1ff98441-7f86-46f5-9da2-c5abfef7afde

📥 Commits

Reviewing files that changed from the base of the PR and between 400f7cf and a697d2e.

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

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


Walkthrough

Step.tsx 使用 isReactRenderable 判断 icon 和 itemRender 的返回值,并据此设置自定义图标类和步骤节点。新增测试覆盖数值、空值及布尔值等渲染情况。

Changes

步骤渲染值判断

Layer / File(s) Summary
渲染值判断与测试
src/Step.tsx, tests/renderability.test.tsx
Step.tsx 使用 isReactRenderable 判断 icon 和 itemRender 的返回值。测试验证 itemRender 返回 0 时保留文本,返回 false、null、undefined 或空字符串时步骤内容为空,并验证 icon 为 0 时添加自定义样式类。

Priority: ⬇️ Low

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to a697d

Zero-valued step content is preserved and the requested icon styling is applied; no concrete user-facing issue is established that should block merging.

🚥 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 1 functions across 2 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 标题准确概括了主要变更:保留 itemRender 返回的 0,并修复 icon={0} 的自定义图标样式判断。标题简洁且与代码和测试变更一致。
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.
  • Fix all pre-merge checks with AI
✨ 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

兔子蹦到步骤旁,
看见零字亮晶晶。
图标虽小也显现,
空值退场不留影。
新测试本上画个圈,
月光下把萝卜分。

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 100.00%. Comparing base (400f7cf) to head (a697d2e).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #399   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines           97        98    +1     
  Branches        36        37    +1     
=========================================
+ Hits            97        98    +1     

☔ 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