mirror of
https://github.com/penpot/penpot.git
synced 2025-01-09 08:20:45 -05:00
Fix constant login redirect on page refresh.
This commit is contained in:
parent
c4ddb9e529
commit
4215429944
4 changed files with 12 additions and 10 deletions
|
@ -10,16 +10,9 @@
|
|||
|
||||
(enable-console-print!)
|
||||
|
||||
(def ^:const ^:private +persistent-keys+
|
||||
[:auth
|
||||
:pages-by-id
|
||||
:shapes-by-id
|
||||
:colors-by-id
|
||||
:projects-by-id])
|
||||
|
||||
(defn- main
|
||||
[]
|
||||
(let [lens (l/select-keys +persistent-keys+)
|
||||
(let [lens (l/select-keys dl/+persistent-keys+)
|
||||
stream (->> (l/focus-atom lens st/state)
|
||||
(rx/from-atom)
|
||||
(rx/dedupe)
|
||||
|
|
|
@ -24,14 +24,21 @@
|
|||
(let [id (:id shape)]
|
||||
(update state :shapes-by-id assoc id shape)))
|
||||
|
||||
(def ^:const ^:private +persistent-keys+
|
||||
[:auth
|
||||
:pages-by-id
|
||||
:shapes-by-id
|
||||
:colors-by-id
|
||||
:projects-by-id])
|
||||
|
||||
(defn persist-state
|
||||
[state]
|
||||
(let [pages (into #{} (vals (:pages-by-id state)))
|
||||
projects (into #{} (vals (:projects-by-id state)))
|
||||
shapes (into #{} (vals (:shapes-by-id state)))
|
||||
color-colls (into #{} (vals (:colors-by-id state)))]
|
||||
|
||||
(assoc! local-storage :data {:pages pages
|
||||
:auth (:auth state)
|
||||
:shapes shapes
|
||||
:projects projects
|
||||
:color-collections color-colls})))
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
(reify
|
||||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
;; (println "update-location" handler route-params)
|
||||
(let [route (merge {:id handler}
|
||||
(when route-params
|
||||
{:params route-params}))]
|
||||
|
@ -35,6 +36,7 @@
|
|||
(reify
|
||||
rs/EffectEvent
|
||||
(-apply-effect [_ state]
|
||||
;; (println "navigate" id params)
|
||||
(let [loc (merge {:handler id}
|
||||
(when params
|
||||
{:route-params params}))]
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
(rs/init {:dashboard {:project-order :name
|
||||
:project-filter ""}
|
||||
:route nil
|
||||
:auth nil
|
||||
:auth {}
|
||||
:workspace nil
|
||||
:shapes-by-id {}
|
||||
:elements-by-id {}
|
||||
|
|
Loading…
Reference in a new issue