@raycast/utils
Advanced tools
Comparing version 1.3.3 to 1.3.4
@@ -46,2 +46,5 @@ "use strict"; | ||
if (typeof cachedState !== "undefined") { | ||
if (cachedState === "undefined") { | ||
return undefined; | ||
} | ||
return JSON.parse(cachedState, reviver); | ||
@@ -57,4 +60,9 @@ } | ||
const newValue = typeof updater === "function" ? updater(stateRef.current) : updater; | ||
const stringifiedValue = JSON.stringify(newValue, replacer); | ||
cache.set(keyRef.current, stringifiedValue); | ||
if (typeof newValue === "undefined") { | ||
cache.set(keyRef.current, "undefined"); | ||
} | ||
else { | ||
const stringifiedValue = JSON.stringify(newValue, replacer); | ||
cache.set(keyRef.current, stringifiedValue); | ||
} | ||
return newValue; | ||
@@ -61,0 +69,0 @@ }, [cache, keyRef, stateRef]); |
{ | ||
"name": "@raycast/utils", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"description": "Set of utilities to streamline building Raycast extensions", | ||
@@ -5,0 +5,0 @@ "author": "Raycast Technologies Ltd.", |
108559
2379