Skip to content

refactor: use renderable guards for pagination items - #721

Merged
yoyo837 merged 1 commit into
react-component:masterfrom
QDyanbing:refactor-renderable-guards
Sep 3, 2026
Merged

refactor: use renderable guards for pagination items#721
yoyo837 merged 1 commit into
react-component:masterfrom
QDyanbing:refactor-renderable-guards

Conversation

@QDyanbing

@QDyanbing QDyanbing commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

说明

  • 使用 isReactRenderable 统一判断翻页和跳转节点是否需要渲染
  • 支持数字 0NaN 等有效 React 内容,并保留交互容器和无障碍属性
  • 统一自定义图标 className 的判断边界
  • @rc-component/util 的最低版本提升到首次提供该 helper 的 ^1.13.0

验证

  • npm run tsc
  • npm test -- tests/itemRender.test.tsx --runInBand
  • git diff --check

关联 ant-design/ant-design#59193

Summary by CodeRabbit

  • Bug 修复
    • 改进分页控件中图标、上一页/下一页及跳转内容的渲染判断,避免不可渲染值导致显示异常。

@vercel

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

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: b31f50bf-1db6-4586-95d5-94d63db9b529

📥 Commits

Reviewing files that changed from the base of the PR and between 1eca64e and da9f2cd.

📒 Files selected for processing (2)
  • package.json
  • src/Pagination.tsx

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

升级 @rc-component/util,并在分页组件中使用 isReactRenderable 判断图标、跳转内容及前后项是否渲染。

Changes

分页渲染判定

Layer / File(s) Summary
接入渲染判定工具
package.json, src/Pagination.tsx
@rc-component/util^1.11.1 升级到 ^1.13.0。图标回退逻辑改用 isReactRenderable
统一分页项渲染条件
src/Pagination.tsx
jumpPrevjumpNextprevnext 的渲染及自定义图标类名判断改用 isReactRenderable

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

Merge Risk: ⚪ Minimal · up to da9f2

Pagination now consistently renders valid React content such as 0 and NaN while keeping default controls and accessibility behavior for non-renderable values. The change is ready to merge with no identified product-facing risk.

Suggested reviewers: afc163, zombiej

Poem

小兔带着补丁跳,
图标渲染条件巧。
前后跳转齐判断,
分页代码更明朗。
依赖升级耳朵翘。

🚥 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 1 files. (1 skipped: 1 … 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 标题准确概括了主要变更:为分页项使用可渲染性判断。标题简洁、明确,并与 Pagination.tsx 的实际修改一致。
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.
Full details: Docstring Coverage

Explanation

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 1 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.69%. Comparing base (1eca64e) to head (da9f2cd).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #721   +/-   ##
=======================================
  Coverage   99.69%   99.69%           
=======================================
  Files           4        4           
  Lines         331      332    +1     
  Branches      152      153    +1     
=======================================
+ Hits          330      331    +1     
  Misses          1        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.

@yoyo837
yoyo837 merged commit 0a607d1 into react-component:master Sep 3, 2026
11 of 12 checks passed
aibayanyu20 added a commit to antdv-next/vue-components that referenced this pull request Sep 10, 2026
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.

2 participants