feat: pagination go input accept number only#55700
Conversation
|
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
👁 Visual Regression Report for PR #55700 Failed ❌
Important There are 1 diffs found in this PR: 🔄
|
Summary of ChangesHello @afc163, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces an enhancement to the pagination component by updating its underlying dependency. The primary impact of this update is the implementation of stricter input validation for the quick jumper functionality, ensuring that users can only enter numerical values. This change aims to improve the robustness and user experience of the pagination component by preventing invalid input. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the @rc-component/pagination dependency to version ~1.2.0 to restrict the quick jumper input to numeric values only. The dependency update is correct. However, this change should be accompanied by a test case to verify the new behavior and prevent future regressions. I have left a comment on the package.json change with a suggestion for a test. Additionally, there is a small typo in the English changelog in the PR description: 'numberic' should be 'numeric'.
| "@rc-component/mutate-observer": "^2.0.0", | ||
| "@rc-component/notification": "~1.2.0", | ||
| "@rc-component/pagination": "~1.1.4", | ||
| "@rc-component/pagination": "~1.2.0", |
There was a problem hiding this comment.
While updating the dependency is correct, this change should be accompanied by a new test case in components/pagination/__tests__/index.test.tsx to verify that the quick jumper input now only accepts numeric values. This will prevent regressions if the dependency is changed in the future or if the behavior of the dependency changes unexpectedly.
Here is an example of what the test could look like:
it('quick jumper input should only accept numbers', () => {
const onChange = jest.fn();
const { container } = render(
<Pagination defaultCurrent={1} total={500} showQuickJumper onChange={onChange} />,
);
const input = container.querySelector(
'.ant-pagination-options-quick-jumper input',
) as HTMLInputElement;
// Test submitting a valid page number
fireEvent.change(input, { target: { value: '20' } });
fireEvent.keyDown(input, { key: 'Enter', code: 'Enter' });
expect(onChange).toHaveBeenCalledWith(20, 10);
expect(onChange).toHaveBeenCalledTimes(1);
// Test submitting a non-numeric value
fireEvent.change(input, { target: { value: 'abc' } });
fireEvent.keyDown(input, { key: 'Enter', code: 'Enter' });
// onChange should not be called again
expect(onChange).toHaveBeenCalledTimes(1);
});
size-limit report 📦
|
More templates
commit: |
Bundle ReportChanges will increase total bundle size by 42 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: antd.min-array-pushAssets Changed:
|
Deploying ant-design-next with
|
| Latest commit: |
13ffe14
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0c581cc5.ant-design-next.pages.dev |
| Branch Preview URL: | https://feat-pagination-jumper-numbe.ant-design-next.pages.dev |
Deploying ant-design with
|
| Latest commit: |
13ffe14
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://32f61520.ant-design.pages.dev |
| Branch Preview URL: | https://feat-pagination-jumper-numbe.ant-design.pages.dev |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #55700 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 800 800
Lines 14770 14770
Branches 3910 3910
=========================================
Hits 14770 14770 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|




中文版模板 / Chinese template
🤔 This is a ...
🔗 Related Issues
close #55637
💡 Background and Solution
📝 Change Log