so many small tweaks due to the fact that the grid was slow.

This commit is contained in:
Bryce Covert
2020-08-12 09:18:59 -07:00
parent 5bc0e957ef
commit 255a73dc30
10 changed files with 192 additions and 161 deletions

View File

@@ -97,6 +97,7 @@
::params-change
[with-user]
(fn [{:keys [user]} [_ params]]
(println "REQUERY")
{:graphql {:token user
:owns-state {:single ::page}
:query-obj (table/query params )
@@ -363,10 +364,21 @@
(re-frame/reg-event-fx
::invoice-updated
[(re-frame/path [::invoice-page :invoices])]
(fn [{:keys [db]} [_ [_ invoice]]]
{:db (merge-by db :id invoice)}))
(fn [{:keys [db]} [_ [_ invoice]]]
(let [by-id (by :id db )]
{:db (if (by-id (:id invoice))
(merge-by db :id invoice)
(into [invoice] db))})))
(re-frame/reg-event-fx
::invoice-edited
[(re-frame/path [::invoice-page :invoices])]
(fn [{:keys [db]} [_ invoice]]
(let [invoice (assoc invoice :class "live-added")]
(let [by-id (by :id db )]
{:db (if (by-id (:id invoice))
(merge-by db :id invoice)
(into [invoice] db))}))))
(re-frame/reg-event-fx
::expense-accounts-updated
@@ -630,5 +642,5 @@
[print-checks-modal]
[handwrite-checks-modal]
[change-expense-accounts-modal {:updated-event [::expense-accounts-updated]}]]
:right-side-bar [appearing-side-bar {:visible? invoice-bar-active?} [form/form {:invoice-created [::invoice-updated]
:right-side-bar [appearing-side-bar {:visible? invoice-bar-active?} [form/form {:invoice-created [::invoice-edited]
:invoice-printed [::checks-printed]}]]}]))}))