Skip to content

[BUG][UI]: Pagination controls mix up query params across different tables #2213

@madhav165

Description

@madhav165

Description

When using pagination controls for tools, prompts, and resources in the admin UI, the URL query parameters get mixed up between different tables. This creates URLs that contain pagination parameters from multiple tables simultaneously, even when only viewing one table.

Current Behavior

When navigating between different tables (tools, prompts, resources) and their pagination controls:

  1. Navigate to Tools page 3 with size 10

    • URL: http://localhost:4444/admin/?tools_page=3&tools_size=10&tools_inactive=false#tools
  2. Switch to Prompts tab and navigate to page 2

    • URL: http://localhost:4444/admin/?tools_page=3&tools_size=10&tools_inactive=false&prompts_page=2&prompts_size=10&prompts_inactive=false#prompts
  3. Switch to Resources tab and navigate to page 2

    • URL: http://localhost:4444/admin/?tools_page=3&tools_size=10&tools_inactive=false&prompts_page=2&prompts_size=10&prompts_inactive=false&resources_page=2&resources_size=10&resources_inactive=false#resources
  4. Switch back to Tools tab

    • URL: Still contains prompts_page, prompts_size, resources_page, etc.

Expected Behavior

Each tab should only have its own table's query parameters in the URL:

  1. When on Tools tab: ?tools_page=3&tools_size=10&tools_inactive=false#tools
  2. When on Prompts tab: ?prompts_page=2&prompts_size=10&prompts_inactive=false#prompts
  3. When on Resources tab: ?resources_page=2&resources_size=10&resources_inactive=false#resources

Root Cause

Two issues were identified:

  1. Pagination controls accumulating params: The updateBrowserUrl() function in pagination_controls.html and updateInactiveUrlState() in admin.html were using a "Build Fresh" approach that preserved existing params, causing params from other tables to accumulate.

  2. Tab switching not cleaning up params: The showTab() function in admin.js did not remove query parameters from other tables when switching between tabs.

Impact

  • URLs become cluttered with irrelevant pagination state
  • Bookmarked URLs may contain confusing mixed parameters
  • URL sharing becomes less user-friendly
  • Parameter pollution makes debugging harder

Files Affected

  • mcpgateway/templates/pagination_controls.html
  • mcpgateway/templates/admin.html
  • mcpgateway/static/admin.js

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfrontendFrontend development (HTML, CSS, JavaScript)

Type

No fields configured for Bug.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions