@reactuses/core 5.0.13 → 5.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -584,6 +584,7 @@ const getInitialState$2 = (key, defaultValue, storage, serializer, onError)=>{
584
584
  if (raw !== undefined && raw !== null) {
585
585
  return serializer == null ? void 0 : serializer.read(raw);
586
586
  }
587
+ return null;
587
588
  } catch (error) {
588
589
  onError == null ? void 0 : onError(error);
589
590
  }
@@ -607,7 +608,8 @@ function useStorage(key, defaultValue, getStorage = ()=>isBrowser ? sessionStora
607
608
  const serializer = (_options_serializer = options.serializer) != null ? _options_serializer : StorageSerializers[type];
608
609
  const [state, setState] = React.useState(getInitialState$2(key, defaultValue, storage, serializer, onError));
609
610
  useDeepCompareEffect(()=>{
610
- const data = effectStorageValue ? isFunction(effectStorageValue) ? effectStorageValue() : effectStorageValue : defaultValue;
611
+ var _ref;
612
+ const data = (_ref = effectStorageValue ? isFunction(effectStorageValue) ? effectStorageValue() : effectStorageValue : defaultValue) != null ? _ref : null;
611
613
  const getStoredValue = ()=>{
612
614
  try {
613
615
  const raw = storage == null ? void 0 : storage.getItem(key);
package/dist/index.mjs CHANGED
@@ -577,6 +577,7 @@ const getInitialState$2 = (key, defaultValue, storage, serializer, onError)=>{
577
577
  if (raw !== undefined && raw !== null) {
578
578
  return serializer == null ? void 0 : serializer.read(raw);
579
579
  }
580
+ return null;
580
581
  } catch (error) {
581
582
  onError == null ? void 0 : onError(error);
582
583
  }
@@ -600,7 +601,8 @@ function useStorage(key, defaultValue, getStorage = ()=>isBrowser ? sessionStora
600
601
  const serializer = (_options_serializer = options.serializer) != null ? _options_serializer : StorageSerializers[type];
601
602
  const [state, setState] = useState(getInitialState$2(key, defaultValue, storage, serializer, onError));
602
603
  useDeepCompareEffect(()=>{
603
- const data = effectStorageValue ? isFunction(effectStorageValue) ? effectStorageValue() : effectStorageValue : defaultValue;
604
+ var _ref;
605
+ const data = (_ref = effectStorageValue ? isFunction(effectStorageValue) ? effectStorageValue() : effectStorageValue : defaultValue) != null ? _ref : null;
604
606
  const getStoredValue = ()=>{
605
607
  try {
606
608
  const raw = storage == null ? void 0 : storage.getItem(key);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactuses/core",
3
- "version": "5.0.13",
3
+ "version": "5.0.14",
4
4
  "license": "Unlicense",
5
5
  "homepage": "https://www.reactuse.com/",
6
6
  "repository": {