Skip to content

fix: preserve zero-valued content and valid jumper markup - #723

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,并让普通及简洁模式的 goButton={0} 正常显示与响应操作。
  • 统一确认按钮的显示与失焦判断,将内部 goButton 类型扩展为 ReactNode。
  • 简洁模式确认按钮包装由 li 改为 span,消除 Options 内嵌套 li 引起的 SSR 水合失败;保留类名、title 和交互。
  • 补充点击/跳页测试,以及零值、默认、自定义按钮的 SSR 水合与节点复用测试;同步更新 3 处结构快照。

验证

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

关联 ant-design/ant-design#59193

Summary by CodeRabbit

  • 功能优化

    • 快速跳转按钮现支持更广泛的 React 内容,包括数字 0 和自定义按钮;相关内容可正常显示并交互。
    • 分页项为 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: 628406ad-e35c-423f-b5e5-d95f050f1283

📥 Commits

Reviewing files that changed from the base of the PR and between 0a607d1 and 430d155.

⛔ Files ignored due to path filters (2)
  • tests/__snapshots__/demo.test.tsx.snap is excluded by !**/*.snap
  • tests/__snapshots__/simple.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (5)
  • src/Options.tsx
  • src/Pager.tsx
  • src/Pagination.tsx
  • tests/hydration.test.tsx
  • tests/renderability.test.tsx

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


Walkthrough

分页组件使用 React 可渲染性判断显示分页项和快速跳转按钮。goButton 类型更新为 React.ReactNode。新增渲染交互与服务端水合测试。

Changes

分页内容渲染

Layer / File(s) Summary
可渲染内容与交互验证
src/Options.tsx, src/Pager.tsx, src/Pagination.tsx, tests/hydration.test.tsx, tests/renderability.test.tsx
goButton 类型改为 React.ReactNode。分页项与快速跳转按钮使用 isReactRenderable 判断是否渲染;简单模式确认按钮的外围容器改为 <span>。新增对 0 值渲染、按钮交互和服务端水合的测试。

Priority: ➖ Normal

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 430d1

The pagination changes are ready to merge after normal checks; no actionable risk remains identified.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 430d1

The changes make zero-valued pagination content usable and correct jumper markup. The reviewed interaction paths retain their existing page-change checks; no new privileged behavior was identified. Broader security coverage remains incomplete.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The newly reachable zero-valued interactions affect an instance's rendered pagination controls and its supplied onChange callback; the inspected changes do not add a service, data-store, or privileged-operation path.

Trust Boundaries and Controls

  • observed — Consumer-supplied button and item content is placed in React child positions. A resulting page change remains subject to Pagination's validity and disabled checks.
🚥 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 标题准确概括了主要变更,包括保留零值内容和修复快速跳转按钮的有效标记。
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 5…
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 99.69%. Comparing base (0a607d1) to head (430d155).

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

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