Better pagination behavior on filter change.

This commit is contained in:
Bryce Covert
2020-08-18 07:24:53 -07:00
parent 441077169f
commit 0c93e84cd2
5 changed files with 19 additions and 7 deletions

View File

@@ -68,6 +68,7 @@
(re-frame/reg-event-db
::dispose
(fn [db [_ id]]
(println "TABLE" (::table-params db) (::table-params (update db ::table-params dissoc id)))
(-> db
(update ::data dissoc id)
(update ::checked dissoc id)
@@ -132,7 +133,9 @@
(re-frame/reg-event-fx
::filters-settled
(fn [{:keys [db]} [_ id]]
{:db (assoc-in db [::settled-filters id] @(re-frame/subscribe [::filters id]))}))
{:db (-> db
(assoc-in [::settled-filters id] @(re-frame/subscribe [::filters id]))
(update-in [::table-params id ] dissoc :start))}))
(re-frame/reg-sub
::settled-filters
@@ -146,7 +149,8 @@
[which val] (if (= 3 (count params))
[(into [a] b) c]
[[a] b])]
{:db (assoc-in db (into [::filters id] which) val)
{:db (-> db
(assoc-in (into [::filters id] which) val))
:dispatch-debounce
{:event [::filters-settled id]
:time 800