Skip to content

fix: preserve zero-valued overflow indicators - #73

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

说明

  • renderRest={0} 使用指定内容,不再回退到默认剩余项文案。
  • 补充零值内容、返回零值的渲染函数及空值回退测试。

验证

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

关联 ant-design/ant-design#59193

Summary by CodeRabbit

  • Bug Fixes
    • 修正剩余项显示逻辑:renderRest 提供可渲染内容(包括 0)时会显示该内容;提供 false、null、undefined 或空字符串时则显示默认文本。
  • Tests
    • 新增对上述剩余项显示行为的测试。

@vercel

vercel Bot commented Sep 28, 2026

Copy link
Copy Markdown

@QDyanbing is attempting to deploy a commit to the React Component 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: c0f5b895-bb50-4608-ab9a-1eed922accd1

📥 Commits

Reviewing files that changed from the base of the PR and between f1c801c and abe69ac.

📒 Files selected for processing (2)
  • src/Overflow.tsx
  • tests/renderability.spec.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

Overflow 现在仅在 renderRest 是 React 可渲染值时使用该值;否则使用默认剩余项内容。新增测试覆盖 0、返回 0 的函数,以及其他指定值。

Changes

Overflow 剩余项渲染

Layer / File(s) Summary
剩余项渲染选择
src/Overflow.tsx, tests/renderability.spec.tsx
mergedRenderRest 仅在 renderRest 是 React 可渲染值时使用它,否则使用默认值。测试验证 0 会被渲染,false、null、undefined 和空字符串会显示默认值。类型排版和类型断言写法也有调整。

Priority: ⬇️ Low

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to abe69

The overflow indicator now preserves zero-valued content, and the reviewed cases retain the intended fallback behavior. No specific issue remains that should block merging.

Security Architecture Review

Security architecture risk: ⚪ Minimal · up to abe69

The public rendering behavior changes narrowly: a supplied zero now appears instead of the default overflow label. The review found no material security risk introduced by this change.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed behavior is bounded to the public Overflow component’s rest-content selection; the inspected render flow adds no sensitive sink.
🚥 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 标题“fix: preserve zero-valued overflow indicators”准确概括了主要变更,即保留值为 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 97.07%. Comparing base (f1c801c) to head (abe69ac).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #73      +/-   ##
==========================================
+ Coverage   97.05%   97.07%   +0.01%     
==========================================
  Files           7        7              
  Lines         340      342       +2     
  Branches      100      102       +2     
==========================================
+ Hits          330      332       +2     
  Misses         10       10              

☔ 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