From 57d83fd9af2c85682c172fd9b7548a52b183430c Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Tue, 13 Oct 2026 14:19:06 -0400 Subject: [PATCH] fix(web): profile save gives visible feedback (HX-Refresh) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The admin/user profile modal PUT succeeded but the response was a bare JSON body swapped into a small div at the bottom of the still-open modal — no close, no toast, nothing moved. It read as 'the button did nothing' even though the save landed. HX-Request calls now answer with HX-Refresh (re-render shows the saved values everywhere and closes the modal) plus a visible confirmation. API callers keep the JSON body. Silent-failure display already exists site-wide (toast.ts listens for htmx:responseError), so failures were never the silent case. --- internal/handlers/auth.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/handlers/auth.go b/internal/handlers/auth.go index e97bdec8..198dd362 100644 --- a/internal/handlers/auth.go +++ b/internal/handlers/auth.go @@ -693,6 +693,15 @@ func (h *AuthHandler) UpdateProfile(c *echo.Context) error { } } + // Browser path (htmx modal + profile page): refresh so every rendered + // value (timezone select, table rows, header) reflects the save and the + // modal closes. A bare JSON body swapped into #profile-result read as + // "nothing happened" — the save DID land, invisibly. + if c.Request().Header.Get("HX-Request") == "true" { + c.Response().Header().Set("HX-Refresh", "true") + return c.HTML(http.StatusOK, `
Profile updated.
`) + } + return c.JSON(http.StatusOK, map[string]string{"message": "profile updated successfully"}) }