Skip to content

fix: preserve zero-valued children - #39

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

说明

  • 保留 children={0},不再将其当作缺少子节点而丢弃或输出错误提示。
  • 使用共享 isReactRenderable 并补充回归测试;将 @rc-component/util 最低版本提升到 ^1.13.0。

验证

  • npm test -- --runInBand(4 项通过)
  • 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: b0d9e8d0-f4b3-42b6-89cd-ec2ac2ff1d9d

📥 Commits

Reviewing files that changed from the base of the PR and between c0d69a4 and fdf4a5d.

📒 Files selected for processing (3)
  • package.json
  • src/MutateObserver.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

MutateObserver 现在使用 isReactRenderable 判断子节点是否可渲染。新增测试验证子节点 0 会被渲染,且不会触发 console.error。@rc-component/util 的版本范围从 ^1.11.1 更新为 ^1.13.0。

Changes

子节点可渲染性

Layer / File(s) Summary
可渲染性判断与测试
package.json, src/MutateObserver.tsx, tests/renderability.test.tsx
依赖版本范围更新为 ^1.13.0。MutateObserver 使用 isReactRenderable 判断子节点。测试验证子节点 0 会被渲染为文本 '0',且不会调用 console.error。

Priority: ⬇️ Low

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to fdf4a

Children set to 0 now renders as text instead of being treated as missing. The verified component path and regression test show this behavior without an actionable merge-blocking risk.

🚥 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 children”准确概括了主要变更:使用 isReactRenderable 保留 children={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

我是小兔,蹦到代码旁,
看见零也安稳登场。
可渲染性检查轻轻亮,
错误日志不再响。
新版本依赖装进篮,
我抱着胡萝卜跳回家。

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 90.90%. Comparing base (c0d69a4) to head (fdf4a5d).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #39      +/-   ##
==========================================
+ Coverage   87.87%   90.90%   +3.03%     
==========================================
  Files           2        2              
  Lines          33       33              
  Branches       10       10              
==========================================
+ Hits           29       30       +1     
+ Misses          4        3       -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