Skip to content

Commit

Permalink
fixed bug in local storage that was causing Inspect to require re-ins…
Browse files Browse the repository at this point in the history
…tall
  • Loading branch information
awkay committed Jul 2, 2021
1 parent 73f00f8 commit 6016dd4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
fulcrologic/fulcro {:mvn/version "2.8.11"}
fulcrologic/fulcro-spec {:mvn/version "2.1.3"}
com.taoensso/sente {:mvn/version "1.15.0"}
com.taoensso/encore {:mvn/version "2.117.0"}
gnl/ghostwheel {:mvn/version "0.3.8"}
nubank/workspaces {:mvn/version "1.0.8"}
nubank/workspaces {:mvn/version "1.0.8" :exclusions [fulcrologic/fulcro-inspect]}
org.clojure/core.async {:mvn/version "0.4.490"}
spec-coerce {:mvn/version "1.0.0-alpha5"}}}
2 changes: 1 addition & 1 deletion shells/chrome/manifest.edn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{:manifest_version 2
:name "Fulcro Inspect"
:version "3.0.4"
:version "3.0.5"
:description "Fulcro is a development framework that uses React and CLJS. This extension adds ability to track Fulcro DB, transactions and network"

:icons {"16" "icon-16.png"
Expand Down
12 changes: 10 additions & 2 deletions src/client/fulcro/inspect/lib/local_storage.cljs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(ns fulcro.inspect.lib.local-storage
(:refer-clojure :exclude [get set!])
(:require [cljs.reader :refer [read-string]]
[fulcro.inspect.remote.transit :as transit]))
[fulcro.inspect.remote.transit :as transit]
[taoensso.timbre :as log]))

(defn read-transit [s]
(transit/read s))
Expand All @@ -13,11 +14,18 @@

;; edn

(declare remove!)

(defn get
([key] (get key nil))
([key default]
(if-let [value (.getItem local-storage (pr-str key))]
(read-string value)
(try
(read-string value)
(catch :default e
(log/error e "Unable to read local storage. Clearing storage key" key)
(remove! key)
default))
default)))

(defn set! [key value]
Expand Down

0 comments on commit 6016dd4

Please sign in to comment.