mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 23:49: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!)
|
(enable-console-print!)
|
||||||
|
|
||||||
(def ^:const ^:private +persistent-keys+
|
|
||||||
[:auth
|
|
||||||
:pages-by-id
|
|
||||||
:shapes-by-id
|
|
||||||
:colors-by-id
|
|
||||||
:projects-by-id])
|
|
||||||
|
|
||||||
(defn- main
|
(defn- main
|
||||||
[]
|
[]
|
||||||
(let [lens (l/select-keys +persistent-keys+)
|
(let [lens (l/select-keys dl/+persistent-keys+)
|
||||||
stream (->> (l/focus-atom lens st/state)
|
stream (->> (l/focus-atom lens st/state)
|
||||||
(rx/from-atom)
|
(rx/from-atom)
|
||||||
(rx/dedupe)
|
(rx/dedupe)
|
||||||
|
|
|
@ -24,14 +24,21 @@
|
||||||
(let [id (:id shape)]
|
(let [id (:id shape)]
|
||||||
(update state :shapes-by-id assoc 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
|
(defn persist-state
|
||||||
[state]
|
[state]
|
||||||
(let [pages (into #{} (vals (:pages-by-id state)))
|
(let [pages (into #{} (vals (:pages-by-id state)))
|
||||||
projects (into #{} (vals (:projects-by-id state)))
|
projects (into #{} (vals (:projects-by-id state)))
|
||||||
shapes (into #{} (vals (:shapes-by-id state)))
|
shapes (into #{} (vals (:shapes-by-id state)))
|
||||||
color-colls (into #{} (vals (:colors-by-id state)))]
|
color-colls (into #{} (vals (:colors-by-id state)))]
|
||||||
|
|
||||||
(assoc! local-storage :data {:pages pages
|
(assoc! local-storage :data {:pages pages
|
||||||
|
:auth (:auth state)
|
||||||
:shapes shapes
|
:shapes shapes
|
||||||
:projects projects
|
:projects projects
|
||||||
:color-collections color-colls})))
|
:color-collections color-colls})))
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
(reify
|
(reify
|
||||||
rs/UpdateEvent
|
rs/UpdateEvent
|
||||||
(-apply-update [_ state]
|
(-apply-update [_ state]
|
||||||
|
;; (println "update-location" handler route-params)
|
||||||
(let [route (merge {:id handler}
|
(let [route (merge {:id handler}
|
||||||
(when route-params
|
(when route-params
|
||||||
{:params route-params}))]
|
{:params route-params}))]
|
||||||
|
@ -35,6 +36,7 @@
|
||||||
(reify
|
(reify
|
||||||
rs/EffectEvent
|
rs/EffectEvent
|
||||||
(-apply-effect [_ state]
|
(-apply-effect [_ state]
|
||||||
|
;; (println "navigate" id params)
|
||||||
(let [loc (merge {:handler id}
|
(let [loc (merge {:handler id}
|
||||||
(when params
|
(when params
|
||||||
{:route-params params}))]
|
{:route-params params}))]
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
(rs/init {:dashboard {:project-order :name
|
(rs/init {:dashboard {:project-order :name
|
||||||
:project-filter ""}
|
:project-filter ""}
|
||||||
:route nil
|
:route nil
|
||||||
:auth nil
|
:auth {}
|
||||||
:workspace nil
|
:workspace nil
|
||||||
:shapes-by-id {}
|
:shapes-by-id {}
|
||||||
:elements-by-id {}
|
:elements-by-id {}
|
||||||
|
|
Loading…
Add table
Reference in a new issue