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

@ -8,7 +8,7 @@
(:require
[app.common.data :as d]
[app.common.data.macros :as dm]
[app.common.files.features :as feat]
[app.common.files.features :as ffeat]
[app.common.time :as dt]
[app.common.types.component :as ctk]))
@ -40,7 +40,7 @@
(cond-> (update-in fdata [:components id] assoc :main-instance-id main-instance-id :main-instance-page main-instance-page)
annotation (update-in [:components id] assoc :annotation annotation))
(let [wrap-object-fn feat/*wrap-with-objects-map-fn*]
(let [wrap-object-fn ffeat/*wrap-with-objects-map-fn*]
(assoc-in fdata [:components id :objects]
(->> shapes
(d/index-by :id)
@ -48,7 +48,7 @@
(defn mod-component
[file-data {:keys [id name path main-instance-id main-instance-page objects annotation]}]
(let [wrap-objects-fn feat/*wrap-with-objects-map-fn*]
(let [wrap-objects-fn ffeat/*wrap-with-objects-map-fn*]
(d/update-in-when file-data [:components id]
(fn [component]
(let [objects (some-> objects wrap-objects-fn)]

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))