Should improve perf somewhat
This commit is contained in:
@@ -28,17 +28,25 @@
|
||||
(fn [db]
|
||||
(-> db ::payment-page)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::last-params
|
||||
(fn [db]
|
||||
(-> db ::last-params)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::params
|
||||
:<- [::last-params]
|
||||
:<- [::subs/client]
|
||||
:<- [::side-bar/filter-params]
|
||||
:<- [::table/table-params]
|
||||
(fn [[client filter-params table-params]]
|
||||
(re-frame/dispatch [::params-change])
|
||||
(cond-> {}
|
||||
client (assoc :client-id (:id client))
|
||||
(seq filter-params) (merge filter-params)
|
||||
(seq table-params) (merge @(re-frame/subscribe [::table/table-params])))))
|
||||
(fn [[last-params client filter-params table-params]]
|
||||
(let [params (cond-> {}
|
||||
client (assoc :client-id (:id client))
|
||||
(seq filter-params) (merge filter-params)
|
||||
(seq table-params) (merge table-params))]
|
||||
(when (not= last-params params)
|
||||
(re-frame/dispatch [::params-change]))
|
||||
params)))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::params-change
|
||||
@@ -104,11 +112,9 @@
|
||||
:status (re-frame/subscribe [::subs/status])
|
||||
:void-event [::void-check]}]]))
|
||||
|
||||
|
||||
(defn payments-page []
|
||||
(reagent/create-class
|
||||
{:display-name "payments-page"
|
||||
:component-did-mount #(re-frame/dispatch [::params-change {}])
|
||||
:component-will-unmount #(re-frame/dispatch [::unmounted])
|
||||
:reagent-render
|
||||
(fn []
|
||||
|
||||
Reference in New Issue
Block a user