fix: sync icon disappear with unstable network

User's groups will be stored in local storage.
pull/7532/head
Tienson Qin 2022-11-30 20:15:03 +08:00
parent c1b27ac308
commit d3300cfcab
2 changed files with 10 additions and 2 deletions

View File

@ -86,7 +86,7 @@
nil nil
(map? result) (map? result)
(do (do
(state/set-state! :user/info result) (state/set-user-info! result)
(let [status (if (user-handler/alpha-or-beta-user?) :welcome :unavailable)] (let [status (if (user-handler/alpha-or-beta-user?) :welcome :unavailable)]
(when (and (= status :welcome) (user-handler/logged-in?)) (when (and (= status :welcome) (user-handler/logged-in?))
(when-not (false? (state/enable-sync?)) ; user turns it off (when-not (false? (state/enable-sync?)) ; user turns it off

View File

@ -263,7 +263,7 @@
:file-sync/graph-state {:current-graph-uuid nil :file-sync/graph-state {:current-graph-uuid nil
;; graph-uuid -> ... ;; graph-uuid -> ...
} }
:user/info {:UserGroups (storage/get :user-groups)}
:encryption/graph-parsing? false :encryption/graph-parsing? false
:ui/loading? {} :ui/loading? {}
@ -2064,3 +2064,11 @@ Similar to re-frame subscriptions"
(when (and shape-id (parse-uuid shape-id)) (when (and shape-id (parse-uuid shape-id))
(. api selectShapes shape-id) (. api selectShapes shape-id)
(. api zoomToSelection))))) (. api zoomToSelection)))))
(defn set-user-info!
[info]
(when info
(set-state! :user/info info)
(let [groups (:UserGroups info)]
(when (seq groups)
(storage/set :user-groups groups)))))