diff --git a/internal/handlers/customers.go b/internal/handlers/customers.go index 15ccf50..98e890a 100644 --- a/internal/handlers/customers.go +++ b/internal/handlers/customers.go @@ -1,6 +1,7 @@ package handlers import ( + "fmt" "net/http" "strconv" @@ -39,6 +40,13 @@ func (h *Handler) CustomerList(w http.ResponseWriter, r *http.Request) { // HTMX partial for search if r.Header.Get("HX-Request") == "true" && r.URL.Query().Get("partial") == "true" { + // Construct clean URL for history + u := fmt.Sprintf("/customers?page=%d", page) + if search != "" { + u += "&search=" + search + } + w.Header().Set("HX-Push-Url", u) + h.renderPartial(w, "customers/list.html", "customer-table", data) return } diff --git a/templates/customers/list.html b/templates/customers/list.html index 13268d1..d32403a 100644 --- a/templates/customers/list.html +++ b/templates/customers/list.html @@ -72,7 +72,8 @@