Ensure features is always initialized, even after logout

This commit is contained in:
Andrés Moya 2023-09-28 17:02:15 +02:00 committed by Alonso Torres
parent 4149b681bd
commit cc07c7a580
5 changed files with 26 additions and 23 deletions

View file

@ -82,7 +82,7 @@
date)))
;; --- Globar Config Vars
;; --- Global Config Vars
(def default-theme "default")
(def default-language "en")

View file

@ -58,25 +58,27 @@
ptk/WatchEvent
(watch [_ state stream]
(rx/merge
;;fetch teams must be first in case the team doesn't exist
(ptk/watch (du/fetch-teams) state stream)
(ptk/watch (df/load-team-fonts id) state stream)
(ptk/watch (fetch-projects) state stream)
(ptk/watch (fetch-team-members) state stream)
(ptk/watch (du/fetch-users {:team-id id}) state stream)
(rx/concat
(rx/of (features/initialize))
(rx/merge
;; fetch teams must be first in case the team doesn't exist
(ptk/watch (du/fetch-teams) state stream)
(ptk/watch (df/load-team-fonts id) state stream)
(ptk/watch (fetch-projects) state stream)
(ptk/watch (fetch-team-members) state stream)
(ptk/watch (du/fetch-users {:team-id id}) state stream)
(let [stoper (rx/filter (ptk/type? ::finalize) stream)
profile-id (:profile-id state)]
(->> stream
(rx/filter (ptk/type? ::dws/message))
(rx/map deref)
(rx/filter (fn [{:keys [subs-id type] :as msg}]
(and (or (= subs-id uuid/zero)
(= subs-id profile-id))
(= :notification type))))
(rx/map handle-notification)
(rx/take-until stoper)))))))
(let [stoper (rx/filter (ptk/type? ::finalize) stream)
profile-id (:profile-id state)]
(->> stream
(rx/filter (ptk/type? ::dws/message))
(rx/map deref)
(rx/filter (fn [{:keys [subs-id type] :as msg}]
(and (or (= subs-id uuid/zero)
(= subs-id profile-id))
(= :notification type))))
(rx/map handle-notification)
(rx/take-until stoper))))))))
(defn finalize
[params]

View file

@ -316,6 +316,7 @@
ptk/WatchEvent
(watch [_ _ _]
(rx/of msg/hide
(features/initialize)
(dcm/retrieve-comment-threads file-id)
(dwp/initialize-file-persistence file-id)
(fetch-bundle project-id file-id)))

View file

@ -100,7 +100,7 @@
;; environemnt (aka devenv).
(when *assert*
;; By default, all features disabled, except in development
;; environment, that are enabled except components-v2
;; environment, that are enabled except components-v2 and new css
(->> (rx/from available-features)
(rx/filter #(not= % :components-v2))
(rx/filter #(not= % :new-css-system))