mirror of
https://tangled.org/evan.jarrett.net/at-container-registry
synced 2026-09-02 16:26:56 +00:00
hold/admin: swap out the deleted crew row instead of sending 204
The delete handler returned 204 No Content for htmx requests, on the theory that an empty body plus hx-swap="outerHTML" would make the row disappear. htmx's default responseHandling maps 204 to swap:false, so it never swapped at all: the record was gone from the PDS but the row stayed on screen until a manual refresh. Return an empty 200, which htmx does swap. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ai43R3s33cBGMybGp2gUcG
This commit is contained in:
co-authored by
Claude Opus 5
parent
2a58ccebd8
commit
c36e90f6b7
@@ -614,12 +614,13 @@ func (ui *AdminUI) handleCrewDelete(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
slog.Info("Crew member removed via admin panel", "did", member.Member, "by", session.DID)
|
||||
|
||||
// For HTMX requests, return 204 No Content. The row uses
|
||||
// For HTMX requests, return an empty 200. The row uses
|
||||
// hx-swap="outerHTML" so htmx replaces it with the empty response body
|
||||
// and the row disappears. Explicit 204 is the stable idiom (plain 200
|
||||
// with empty body works today but is implementation-defined).
|
||||
// and the row disappears. Not 204: htmx's default responseHandling maps
|
||||
// 204 to swap:false, so the deleted row would stay on screen until a
|
||||
// manual refresh.
|
||||
if r.Header.Get("HX-Request") == "true" {
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
w.WriteHeader(http.StatusOK)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user