-
Notifications
You must be signed in to change notification settings - Fork 519
Description
π Bug Summary
After creating, updating, or deleting a team in the Admin UI, the teams list always resets to page 1. If a user is browsing page 5 of teams and creates a new team, they are silently jumped back to page 1, losing their pagination context.
π§© Affected Component
-
mcpgateway- API -
mcpgateway- UI (admin panel) -
mcpgateway.wrapper- stdio wrapper - Federation or Transports
- CLI, Makefiles, or shell scripts
- Container setup (Docker/Podman/Compose)
- Other (explain below)
π Steps to Reproduce
- Navigate to Admin β Teams (
/admin/#teams) - Ensure there are enough teams to span multiple pages (>10)
- Navigate to page 3 or deeper
- Click Create New Team, fill in details, submit
- Observe: the teams list reloads showing page 1
π€ Expected Behavior
After creating a team, the list should either:
- Stay on the current page (preserving pagination context), or
- Navigate to the page containing the newly created team
π Logs / Error Output
No errors β this is a UX behavior issue, not a crash.
Root Cause
Both refresh code paths hardcode page=1:
-
initializeTeamManagement()inmcpgateway/templates/admin.html:14721:let url = window.ROOT_PATH + '/admin/teams/partial?page=1&per_page=10';
This is called after team creation via the
htmx:afterRequesthandler at line 14756. -
handleAdminTeamAction()inmcpgateway/static/admin.js:21876:params.set("page", "1"); // Reset to first page on action
This is called after team update/delete via the
HX-Trigger: adminTeamActionmechanism.
Both paths preserve search query and relationship filter state, but neither preserves the current page number.
Proposed Solution
Track the current page in a variable or read it from the DOM/URL, and pass it through on refresh:
// In initializeTeamManagement():
const currentPage = getCurrentTeamsPage() || 1; // Read from active pagination state
let url = window.ROOT_PATH + '/admin/teams/partial?page=' + currentPage + '&per_page=10';For team creation specifically, resetting to page 1 may actually be desirable (so the user can see the new team sorted at the top), but for update/delete operations, preserving the current page is more intuitive.
π§© Additional Context
Discovered during review of PR #2780. This is pre-existing behavior, not introduced by that PR. The same pattern likely affects other admin sections β worth auditing Servers, Tools, Gateways, and A2A Agents for the same issue.