mirror of
https://github.com/penpot/penpot.git
synced 2025-07-01 12:37:16 +02:00
Fix bugs in new storage impl.
This commit is contained in:
parent
3ab64e5a68
commit
8c996f3a57
2 changed files with 9 additions and 11 deletions
|
@ -18,7 +18,7 @@
|
||||||
{:dashboard {:project-order :name
|
{:dashboard {:project-order :name
|
||||||
:project-filter ""}
|
:project-filter ""}
|
||||||
:route nil
|
:route nil
|
||||||
:auth (:auth storage nil)
|
:auth (:uxbox/auth storage nil)
|
||||||
:clipboard #queue []
|
:clipboard #queue []
|
||||||
:profile nil
|
:profile nil
|
||||||
:workspace nil
|
:workspace nil
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
(defn- persist
|
(defn- persist
|
||||||
[alias value]
|
[alias value]
|
||||||
(let [key (name value)
|
(let [key (name alias)
|
||||||
value (t/encode value)]
|
value (t/encode value)]
|
||||||
(.setItem js/localStorage key value)))
|
(.setItem js/localStorage key value)))
|
||||||
|
|
||||||
|
@ -19,12 +19,10 @@
|
||||||
[alias]
|
[alias]
|
||||||
(if (= *target* "nodejs")
|
(if (= *target* "nodejs")
|
||||||
{}
|
{}
|
||||||
(when-let [data (.getItem js/localStorage (name alias))]
|
(let [data (.getItem js/localStorage (name alias))]
|
||||||
(try
|
(if data
|
||||||
(t/decode data)
|
(t/decode data)
|
||||||
(catch js/Error e
|
{}))))
|
||||||
(js/console.log (.-stack e))
|
|
||||||
{})))))
|
|
||||||
|
|
||||||
(defn make-storage
|
(defn make-storage
|
||||||
[alias]
|
[alias]
|
||||||
|
@ -46,13 +44,13 @@
|
||||||
|
|
||||||
ISwap
|
ISwap
|
||||||
(-swap! [self f]
|
(-swap! [self f]
|
||||||
(-swap! data f))
|
(swap! data f))
|
||||||
(-swap! [self f x]
|
(-swap! [self f x]
|
||||||
(-swap! data f x))
|
(swap! data f x))
|
||||||
(-swap! [self f x y]
|
(-swap! [self f x y]
|
||||||
(-swap! data f x y))
|
(swap! data f x y))
|
||||||
(-swap! [self f x y more]
|
(-swap! [self f x y more]
|
||||||
(-swap! data f x y more))
|
(apply swap! data f x y more))
|
||||||
|
|
||||||
ILookup
|
ILookup
|
||||||
(-lookup [_ key]
|
(-lookup [_ key]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue