-
Notifications
You must be signed in to change notification settings - Fork 613
[BUG][UI]: Redundant HX-Retarget headers in team creation error handlers after #2780 #2800
Description
🐞 Bug Summary
After #2780 changed the team creation form's hx-target from #unified-teams-list to #create-team-error, all error handlers in admin_create_team() still send HX-Retarget: #create-team-error and HX-Reswap: innerHTML headers. These headers are now redundant — they retarget to the element that is already the form's default target.
This is not a functional bug (behavior is correct), but it is dead code that obscures the actual HTMX flow and could confuse future maintainers.
🧩 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
- Read
mcpgateway/admin.pylines 4025-4101 - Observe that the form's
hx-targetis#create-team-error(set inadmin.html:14157) - Observe all error handlers set
HX-Retarget: #create-team-error— same target
🤔 Expected Behavior
Either:
- Remove the redundant
HX-RetargetandHX-Reswapheaders from all error handlers (lines 4028-4029, 4044-4045, 4080-4081, 4090-4091, 4099-4100), since the form already targets#create-team-error - Or document that they are intentionally kept as defensive headers
Note: The htmx:beforeSwap handler at admin.html:40-57 checks hasRetarget to decide whether to swap 4xx responses. However, it also checks isTeamForm (via data-team-validation="true" attribute), which is independently sufficient. So removing HX-Retarget will not break the swap behavior for this form.
📓 Logs / Error Output
N/A — no functional impact.
🧩 Additional Context
Discovered during review of PR #2780. Before that PR, hx-target was #unified-teams-list, so HX-Retarget: #create-team-error was essential to redirect errors away from the teams list. After #2780, the target changed but the headers were not cleaned up.
Low priority — cosmetic code hygiene.