Improve pages fetching on dashboard.

This commit is contained in:
Andrey Antukh 2019-11-27 19:54:25 +01:00
parent 426677935e
commit 761a3c102f
4 changed files with 14 additions and 14 deletions

View file

@ -75,11 +75,6 @@
(update [_ state]
(reduce assoc-project state projects))))
;; ptk/WatchEvent
;; (watch [_ state stream]
;; (->> (rx/from-coll (map :id projects))
;; (rx/map udp/fetch-pages))))
(defn projects-fetched?
[v]
(= ::projects-fetched (ptk/type v)))
@ -177,8 +172,8 @@
(ptk/reify ::go-to
ptk/WatchEvent
(watch [_ state stream]
(let [page-id (get-in state [:projects id :ref-page-id])]
(let [params {:project id :page page-id}]
(let [page-ids (get-in state [:projects id :pages])]
(let [params {:project id :page (first page-ids)}]
(rx/of (rt/nav :workspace/page params)))))))

View file

@ -80,7 +80,7 @@
;; Activate loaded if page is not fetched.
(when-not page (reset! st/loader true))
(rx/merge
;; TODO: the `fetch-pages` should fetch a limited set of attrs
;; TODO: the `fetch-pages` should fetch a limited set of attrs?
(rx/of (udp/fetch-page page-id))
(rx/of (udp/fetch-pages project-id))
(->> stream