-
Notifications
You must be signed in to change notification settings - Fork 319
fix(pager): fix pager init current page error #3640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughVersion bumped renderless package to 3.25.1. In pager/vue.ts, the initialization order of state fields was reordered: internalPageSize now initializes before internalCurrentPage. No watcher or export changes. Changes
Sequence Diagram(s)sequenceDiagram
participant App as App
participant Pager as Pager Component
participant State as State
participant Watchers as Watchers
App->>Pager: Create
Pager->>State: init internalPageSize
Pager->>State: init internalCurrentPage
Pager->>Watchers: register watchers
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~4 minutes Poem
✨ Finishing Touches
🧪 Generate 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/renderless/src/pager/vue.ts (2)
146-148
: Guard against regressions with an explicit commentSince init order is now semantically important, add a brief comment to make this dependency obvious to future maintainers.
state.internalPageSize = api.getInternalPageSize() + // Important: compute internalCurrentPage after internalPageSize so pageCount validation uses the up-to-date pageSize state.internalCurrentPage = api.getValidCurrentPage(props.currentPage)
147-147
: Add a regression test for initialization behaviorPlease add a test that mounts the pager with:
- a specific pageSize (or pageSizes + pageSize) and
- a non-default currentPage,
and asserts internalCurrentPage equals the validated value after mount. Include cases where currentPage exceeds pageCount and where it’s within range.I can help draft the test if you point me to the existing pager test suite location.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/renderless/package.json
(1 hunks)packages/renderless/src/pager/vue.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: PR E2E Test (pnpm test:e2e3)
🔇 Additional comments (2)
packages/renderless/package.json (1)
3-3
: Patch version bump to 3.25.1 — LGTMPatch bump matches a small internal fix; no further changes needed here.
packages/renderless/src/pager/vue.ts (1)
147-147
: Correct init order fixes current-page initialization — LGTMSetting pageSize before computing a valid currentPage ensures clamping uses the correct page count. This addresses the reported init issue.
PR
修复分页组件初始化current-page不生效问题
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit