diff --git a/backend/internal/web/handlers_tasks.go b/backend/internal/web/handlers_tasks.go index 3dfb575..78977ff 100644 --- a/backend/internal/web/handlers_tasks.go +++ b/backend/internal/web/handlers_tasks.go @@ -276,7 +276,7 @@ func TaskDeleteHandler(deps TasksDeps) http.HandlerFunc { if r.Header.Get("HX-Request") == "true" { w.Header().Set("Content-Type", "text/html; charset=utf-8") // Return empty zone div so HTMX removes the card from the DOM (TASK-06). - fmt.Fprintf(w, `
`, task.ID.String()) + _ = templates.TaskCardGone(task.ID).Render(r.Context(), w) return } http.Redirect(w, r, "/tablos/"+tablo.ID.String(), http.StatusSeeOther) diff --git a/backend/templates/tasks.templ b/backend/templates/tasks.templ index 158ad5e..59cc3ff 100644 --- a/backend/templates/tasks.templ +++ b/backend/templates/tasks.templ @@ -338,6 +338,12 @@ templ AddTaskTrigger(tabloID uuid.UUID, status sqlc.TaskStatus, csrfToken string >+ Add task } +// TaskCardGone renders an empty zone div with the task's id so HTMX outerHTML +// swap removes the card from the DOM after a successful delete (TASK-06). +templ TaskCardGone(taskID uuid.UUID) { +
+} + // TaskCardOOB renders a new TaskCard AND an OOB swap that resets the add-task // slot to AddTaskTrigger. Used by TaskCreateHandler to perform both operations // in a single HTMX response.