fix(ssr): bulk-edit empty-selection 500 + modal-footer EDN leak

- BUG D: clicking "Bulk Edit" with no invoices selected 500'd. selected->ids
  returns nil with no selection, and all-ids-not-locked fed that nil into a
  Datomic `:in $ [?i ...]` query ("Unable to find data source"). Guard the body
  with (when (seq all-ids) ...) so an empty selection yields [] and the modal
  opens cleanly. Verified live: no "Oh, drat" toast, no 500.

- BUG B: modal-footer- called (hx/alpine-appear ...) twice; the 2nd return value
  (an attribute map) landed in child position and rendered as literal EDN
  ({:x-show ...}) in the red error banner whenever unexpectedError flipped true.
  Delete the duplicate. Verified: rendered HTML now has one alpine-appear and no
  EDN-text child. (Pre-existing defect, also present on master.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-27 13:21:50 -07:00
parent da2cc711d4
commit fc8ce2633e
3 changed files with 23 additions and 17 deletions

View File

@@ -55,7 +55,6 @@
(defn modal-footer- [params & children]
[:div {:class "p-4 border-t"}
[:span.items-center.bg-red-100.text-red-800.text-xs.font-medium.mb-2.p-1.rounded-full.inline-flex
(hx/alpine-appear {:x-show "unexpectedError" :class "dark:bg-red-900 dark:text-red-300"})
(hx/alpine-appear {:x-show "unexpectedError" :class "dark:bg-red-900 dark:text-red-300"})
[:span {:class "w-2 h-2 bg-red-500 rounded-full"}]
[:span.px-2.py-0.5 "An unexpected error has occured. Integreat staff have been notified."]]

View File

@@ -1486,16 +1486,17 @@
;; TODO clientize
(defn all-ids-not-locked [all-ids]
(->> all-ids
(dc/q '[:find ?i
:in $ [?i ...]
:where
[?i :invoice/client ?c]
[(get-else $ ?c :client/locked-until #inst "2000-01-01") ?lu]
[?i :invoice/date ?d]
[(>= ?d ?lu)]]
(dc/db conn))
(map first)))
(when (seq all-ids)
(->> all-ids
(dc/q '[:find ?i
:in $ [?i ...]
:where
[?i :invoice/client ?c]
[(get-else $ ?c :client/locked-until #inst "2000-01-01") ?lu]
[?i :invoice/date ?d]
[(>= ?d ?lu)]]
(dc/db conn))
(map first))))
(defn- bulk-edit-account-row*
"One expense-account row (no cursor). The location cell swaps just itself
(#account-location-<index>, Rule 2); the percentage swaps only #expense-totals