fix: safe cursor indexing in simple-mode-fields*
This commit is contained in:
@@ -181,17 +181,14 @@
|
|||||||
|
|
||||||
(defn simple-mode-fields*
|
(defn simple-mode-fields*
|
||||||
"Renders the simple-mode account + location row and the toggle-to-advanced link.
|
"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]
|
[request]
|
||||||
(let [snapshot (-> request :multi-form-state :snapshot)
|
(let [snapshot (-> request :multi-form-state :snapshot)
|
||||||
client-id (or (-> request :entity :transaction/client :db/id)
|
client-id (or (-> request :entity :transaction/client :db/id)
|
||||||
(:transaction/client snapshot))
|
(:transaction/client snapshot))
|
||||||
existing-row (first (:transaction/accounts snapshot))
|
existing-row (first (:transaction/accounts snapshot))
|
||||||
account-val (or (:transaction-account/account existing-row)
|
account-val (: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)))))
|
|
||||||
location-val (or (:transaction-account/location existing-row) "Shared")
|
location-val (or (:transaction-account/location existing-row) "Shared")
|
||||||
account-id (when (nat-int? account-val)
|
account-id (when (nat-int? account-val)
|
||||||
(dc/pull (dc/db conn) '[:account/location] account-val))
|
(dc/pull (dc/db conn) '[:account/location] account-val))
|
||||||
@@ -201,7 +198,7 @@
|
|||||||
0.0))]
|
0.0))]
|
||||||
[:div
|
[:div
|
||||||
(fc/with-field :transaction/accounts
|
(fc/with-field :transaction/accounts
|
||||||
(fc/with-cursor (nth fc/*current* 0)
|
(fc/with-cursor (nth fc/*current* 0 nil)
|
||||||
[:span
|
[:span
|
||||||
(fc/with-field :db/id
|
(fc/with-field :db/id
|
||||||
(com/hidden {:name (fc/field-name)
|
(com/hidden {:name (fc/field-name)
|
||||||
|
|||||||
Reference in New Issue
Block a user