Repository navigation
fix: preserve zero-valued step content and icon styles - #399
Conversation
|
@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. |
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
| Layer / File(s) | Summary |
|---|---|
渲染值判断与测试 src/Step.tsx, tests/renderability.test.tsx |
Step.tsx 使用 isReactRenderable 判断 icon 和 itemRender 的返回值。测试验证 itemRender 返回 0 时保留文本,返回 false、null、undefined 或空字符串时步骤内容为空,并验证 icon 为 0 时添加自定义样式类。 |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Merge Risk: 
Minimal · previous review 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 ⚠️ WarningDocstring 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.
-
Finishing Touches
-
Fix failing CI checks
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
兔子蹦到步骤旁,
看见零字亮晶晶。
图标虽小也显现,
空值退场不留影。
新测试本上画个圈,
月光下把萝卜分。
ℹ️ Recent review info
-
⚙️ Run configuration
-
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 1ff98441-7f86-46f5-9da2-c5abfef7afde
📒 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.
ℹ️ Recent review info
-
⚙️ Run configuration
-
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID:
1ff98441-7f86-46f5-9da2-c5abfef7afde
📒 Files selected for processing (2)
-
src/Step.tsxtests/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.
-
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
结论先行
主要变更内容步骤内容与图标样式
- [`${itemCls}-custom`]: icon,
+ [`${itemCls}-custom`]: isReactRenderable(icon),
- stepNode = (itemRender(stepNode, renderInfo) || null) as React.ReactElement;
+ const renderedNode = itemRender(stepNode, renderInfo);
+ stepNode = isReactRenderable(renderedNode) ? renderedNode : null;问题清单(按重要程度排序)🔴 高优先级(阻塞合并)无。 🟡 中优先级(建议修复)
🟢 低优先级(可选改进)无。 |
|
这个改动应该必须发minor了,antd有代码需要适配。 |
之前的效果算bug的话,就另说了。 |
安全起见 minor |
说明
itemRender返回的0,避免将有效内容替换成 null。icon={0}正确标记自定义图标样式,补充零值与空值回归测试。验证
npm test -- --runInBand(30 项通过)npm run tsc关联 ant-design/ant-design#59193
Summary by CodeRabbit
0可以正常显示;无效或空内容不会生成步骤内容。