Fix pagination URL parameter mixing across tables#2214
Merged
crivetimihai merged 1 commit intomainfrom Jan 21, 2026
Merged
Conversation
Fixes pagination controls to properly namespace and clean up query parameters when navigating between different tables (tools, prompts, resources) in the admin UI. Problem: Pagination parameters were accumulating across tabs, resulting in messy URLs like ?tools_page=3&prompts_page=2&resources_page=1 Solution: Each tab now maintains its own clean URL state. When switching tabs, URL params are cleaned to only include the current tab's params plus global params (team_id). Changes: - Fixed updateBrowserUrl() in pagination_controls.html to preserve existing params while updating current table's params - Fixed updateInactiveUrlState() in admin.html to preserve params from other tables when toggling inactive filter - Added getTableNamesForTab() for dynamic table detection via DOM - Added cleanUpUrlParamsForTab() to clean stale params on tab switch Note: Tab pagination state is not preserved across tab switches. When returning to a tab, pagination starts fresh at page 1. Closes #2213 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
ea17913 to
c248865
Compare
Member
Maintainer Review & RebaseRebased onto main and resolved merge conflict with observability cleanup code. Changes Made:
Code Review Notes:✅ Security: No issues - URL params are safely handled via ✅ Performance: Efficient - ✅ Consistency: Matches existing URL manipulation patterns in codebase Behavior Clarification:The original PR description implied pagination state is preserved across tab switches ("Switch back to Tools restores page 3"). However, the implementation cleans URL params on tab switch, so tab state resets to page 1 when returning to a tab. This is actually cleaner behavior - each tab has its own clean URL without param accumulation. Updated commit message to reflect this accurately. |
crivetimihai
approved these changes
Jan 21, 2026
kcostell06
pushed a commit
to kcostell06/mcp-context-forge
that referenced
this pull request
Feb 24, 2026
) Fixes pagination controls to properly namespace and clean up query parameters when navigating between different tables (tools, prompts, resources) in the admin UI. Problem: Pagination parameters were accumulating across tabs, resulting in messy URLs like ?tools_page=3&prompts_page=2&resources_page=1 Solution: Each tab now maintains its own clean URL state. When switching tabs, URL params are cleaned to only include the current tab's params plus global params (team_id). Changes: - Fixed updateBrowserUrl() in pagination_controls.html to preserve existing params while updating current table's params - Fixed updateInactiveUrlState() in admin.html to preserve params from other tables when toggling inactive filter - Added getTableNamesForTab() for dynamic table detection via DOM - Added cleanUpUrlParamsForTab() to clean stale params on tab switch Note: Tab pagination state is not preserved across tab switches. When returning to a tab, pagination starts fresh at page 1. Closes IBM#2213 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🐛 Bug-fix PR
Fixes #2213
Summary
Fixes pagination controls to properly namespace and clean up query parameters when navigating between different tables (tools, prompts, resources) in the admin UI.
Problem
Pagination query parameters were accumulating across different tables, resulting in URLs like:
Each tab should only have its own table's parameters in the URL.
Changes
1. Fixed
updateBrowserUrl()inpagination_controls.html2. Fixed
updateInactiveUrlState()inadmin.html3. Enhanced
showTab()inadmin.jsgetTableNamesForTab()function that scans DOM for pagination controls (id="*-pagination-controls")cleanUpUrlParamsForTab()function that removes params for tables not in current tabBehavior After Fix
Navigation within a table
tools_pagetools_size, resetstools_pageto 1tools_inactive, resetstools_pageto 1Switching between tabs
?tools_page=3&tools_size=10&tools_inactive=false#tools?prompts_page=1&prompts_size=10&prompts_inactive=false#prompts?tools_page=3&tools_size=10&tools_inactive=false#toolsGlobal params preservation
team_idparameter is always preserved across all operationsImplementation Details
Dynamic Detection:
The solution uses convention-based DOM scanning to detect pagination tables. When switching tabs, it:
[id$="-pagination-controls"]"tools-pagination-controls"→"tools")team_id)Example: Switching to Tools tab finds
<div id="tools-pagination-controls">, extracts"tools", and keeps onlytools_page,tools_size,tools_inactive, andteam_idparams.This approach requires zero maintenance when adding new paginated tables - just follow the existing
{tableName}-pagination-controlsnaming convention.Notes
🧪 Verification
make lintmake test📐 MCP Compliance (if relevant)
✅ Checklist
make black isort pre-commit)