From 8a676718a74febcd8833dbd4af68f9d0df62f375 Mon Sep 17 00:00:00 2001 From: Bryce Date: Thu, 18 Jun 2026 22:06:37 -0700 Subject: [PATCH] feat(ssr): reset transaction selection after bulk code Bulk coding left the checked items selected after the table refreshed. Add a dedicated reset-selection event that the grid's Alpine state listens for, and fire it alongside refreshTable on bulk-code submit. Co-Authored-By: Claude Opus 4.8 --- src/clj/auto_ap/ssr/grid_page_helper.clj | 1 + src/clj/auto_ap/ssr/transaction/bulk_code.clj | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/clj/auto_ap/ssr/grid_page_helper.clj b/src/clj/auto_ap/ssr/grid_page_helper.clj index 0af5b704..877827e9 100644 --- a/src/clj/auto_ap/ssr/grid_page_helper.clj +++ b/src/clj/auto_ap/ssr/grid_page_helper.clj @@ -282,6 +282,7 @@ [:div {:x-data (hx/json {:selected [] :all_selected false :type (:entity-name grid-spec)}) "x-on:copy" "if (selected.length > 0) {$clipboard(JSON.stringify({'type': type, 'selected': selected}))}" "x-on:client-selected.document" "selected=[]; all_selected=false" + "x-on:reset-selection.document" "selected=[]; all_selected=false" "x-bind:hx-vals" "JSON.stringify({selected: $data.selected, 'all-selected': $data.all_selected})" :x-init "$watch('selected', s=> $dispatch('selectedChanged', {selected: s, all_selected: all_selected}) ); $watch('all_selected', a=>$dispatch('selectedChanged', {selected: selected, all_selected: a}))"} diff --git a/src/clj/auto_ap/ssr/transaction/bulk_code.clj b/src/clj/auto_ap/ssr/transaction/bulk_code.clj index 2d9bda5f..c275da01 100644 --- a/src/clj/auto_ap/ssr/transaction/bulk_code.clj +++ b/src/clj/auto_ap/ssr/transaction/bulk_code.clj @@ -326,7 +326,7 @@ (html-response (com/success-modal {:title "Transactions Coded"} [:p (str "Successfully coded " (count all-ids) " transactions.")]) - :headers {"hx-trigger" "refreshTable"}))))) + :headers {"hx-trigger" "refreshTable, reset-selection"}))))) (defn- vendor-default-account [vendor-id client-id] "Returns the vendor's standard default account. For single-client contexts,