fix: safe cursor indexing in simple-mode-fields*

This commit is contained in:
2026-05-27 21:44:54 -07:00
parent 00b5303c28
commit a88dcf4122

View File

@@ -181,17 +181,14 @@
(defn simple-mode-fields*
"Renders the simple-mode account + location row and the toggle-to-advanced link.
Must be called within a fc/start-form + fc/with-field :step-params context."
Must be called within a fc/start-form + fc/with-field :step-params context.
Caller must establish Alpine x-data with simpleAccountId in scope."
[request]
(let [snapshot (-> request :multi-form-state :snapshot)
client-id (or (-> request :entity :transaction/client :db/id)
(:transaction/client snapshot))
existing-row (first (:transaction/accounts snapshot))
account-val (or (:transaction-account/account existing-row)
(fc/with-field :transaction/accounts
(fc/with-cursor (nth fc/*current* 0)
(fc/with-field :transaction-account/account
(fc/field-value)))))
account-val (:transaction-account/account existing-row)
location-val (or (:transaction-account/location existing-row) "Shared")
account-id (when (nat-int? account-val)
(dc/pull (dc/db conn) '[:account/location] account-val))
@@ -201,7 +198,7 @@
0.0))]
[:div
(fc/with-field :transaction/accounts
(fc/with-cursor (nth fc/*current* 0)
(fc/with-cursor (nth fc/*current* 0 nil)
[:span
(fc/with-field :db/id
(com/hidden {:name (fc/field-name)