OCPBUGS-78390: Reset pagination page when changing namespace#16138
OCPBUGS-78390: Reset pagination page when changing namespace#16138rhamilto wants to merge 1 commit intoopenshift:mainfrom
Conversation
When switching namespaces/projects via the project picker, the page query parameter was persisting from the previous namespace, causing the table to display incorrectly (e.g., showing "51-3 of 3" with no data rows when navigating from page 2 of one project to another project with fewer items). This fix addresses the issue at two layers: 1. Navigation layer (formatNamespaceRoute): Removes the 'page' query parameter when building the new URL during namespace changes, while preserving 'perPage' as a user preference. 2. Component layer (useConsoleDataViewData): Tracks namespace changes and resets pagination to page 1 when the namespace changes, similar to how it already resets when filters change. Together, these changes ensure pagination properly resets to page 1 when switching namespaces while preserving the user's items-per-page preference. Tests have been added to verify the pagination query parameter handling in formatNamespaceRoute, covering namespace changes, query param preservation, and edge cases. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
@rhamilto: This pull request references Jira Issue OCPBUGS-78390, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/assign @vikram-raj |
📝 WalkthroughWalkthroughThis change implements pagination reset logic when the active namespace changes within the data view. The implementation tracks namespace changes via a ref comparison, extends the pagination reset condition to trigger on namespace changes, and modifies the 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment Tip CodeRabbit can use oxc to improve the quality of JavaScript and TypeScript code reviews.Add a configuration file to your project to customize how CodeRabbit runs oxc. |
|
/cherry-pick release-4.21 |
|
@rhamilto: once the present PR merges, I will cherry-pick it on top of DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/jira refresh |
|
@rhamilto: This pull request references Jira Issue OCPBUGS-78390, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
Requesting review from QA contact: DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/retest |
2 similar comments
|
/retest |
|
/retest |
|
@rhamilto: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhamilto, vikram-raj The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/assign @yapei |
|
@yanpzhan will help verify |
Summary
Fixes OCPBUGS-78390 - When switching namespaces/projects via the project picker, the page query parameter was persisting from the previous namespace, causing the table to display incorrectly (e.g., showing "51-3 of 3" with no data rows).
After
Screen.Recording.2026-03-12.at.2.43.28.PM.mov
Changes
This fix addresses the issue at two layers:
Navigation layer (ui.ts) -
formatNamespaceRoute()removes thepagequery parameter when building the new URL during namespace changes, while preservingperPageas a user preference.Component layer (useConsoleDataViewData.tsx) - Tracks namespace changes and resets pagination to page 1 when the namespace changes, similar to how it already resets when filters change.
Testing
/k8s/all-namespaces/core~v1~Pod?page=2&perPage=50, switch to a different namespace → pagination resets to page 1, perPage is preservedTest Plan
/k8s/all-namespaces/core~v1~Pod?page=2&perPage=50openshift-apiservernamespace?perPage=50(page param removed, perPage preserved)🤖 Generated with Claude Code
Summary by CodeRabbit