From 6016dd41b38643e124b280e9529a082d8f0baedf Mon Sep 17 00:00:00 2001 From: Tony Kay Date: Fri, 2 Jul 2021 15:13:35 -0700 Subject: [PATCH] fixed bug in local storage that was causing Inspect to require re-install --- deps.edn | 3 ++- shells/chrome/manifest.edn | 2 +- src/client/fulcro/inspect/lib/local_storage.cljs | 12 ++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/deps.edn b/deps.edn index 0b29a0a..396ac1b 100644 --- a/deps.edn +++ b/deps.edn @@ -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"}}} diff --git a/shells/chrome/manifest.edn b/shells/chrome/manifest.edn index 5b0d1b3..b6b0e23 100644 --- a/shells/chrome/manifest.edn +++ b/shells/chrome/manifest.edn @@ -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" diff --git a/src/client/fulcro/inspect/lib/local_storage.cljs b/src/client/fulcro/inspect/lib/local_storage.cljs index fb64f02..ae5aeb5 100644 --- a/src/client/fulcro/inspect/lib/local_storage.cljs +++ b/src/client/fulcro/inspect/lib/local_storage.cljs @@ -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)) @@ -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]