@reactuses/core 5.0.3 → 5.0.4
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 +3 -9
- package/dist/index.mjs +3 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -577,15 +577,10 @@ function useStorage(key, defaultValue, getStorage = ()=>isBrowser ? sessionStora
|
|
|
577
577
|
onError(err);
|
|
578
578
|
}
|
|
579
579
|
const type = guessSerializerType(defaultValue);
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
return (_options_serializer = options.serializer) != null ? _options_serializer : StorageSerializers[type];
|
|
583
|
-
}, [
|
|
584
|
-
options.serializer,
|
|
585
|
-
type
|
|
586
|
-
]);
|
|
580
|
+
var _options_serializer;
|
|
581
|
+
const serializer = (_options_serializer = options.serializer) != null ? _options_serializer : StorageSerializers[type];
|
|
587
582
|
const [state, setState] = React.useState(getInitialState$2(key, defaultValue, storage, serializer, onError));
|
|
588
|
-
|
|
583
|
+
useDeepCompareEffect(()=>{
|
|
589
584
|
const data = effectStorageValue ? isFunction(effectStorageValue) ? effectStorageValue() : effectStorageValue : defaultValue;
|
|
590
585
|
const getStoredValue = ()=>{
|
|
591
586
|
try {
|
|
@@ -601,7 +596,6 @@ function useStorage(key, defaultValue, getStorage = ()=>isBrowser ? sessionStora
|
|
|
601
596
|
}
|
|
602
597
|
};
|
|
603
598
|
setState(getStoredValue());
|
|
604
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
605
599
|
}, [
|
|
606
600
|
key,
|
|
607
601
|
serializer,
|
package/dist/index.mjs
CHANGED
|
@@ -570,15 +570,10 @@ function useStorage(key, defaultValue, getStorage = ()=>isBrowser ? sessionStora
|
|
|
570
570
|
onError(err);
|
|
571
571
|
}
|
|
572
572
|
const type = guessSerializerType(defaultValue);
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
return (_options_serializer = options.serializer) != null ? _options_serializer : StorageSerializers[type];
|
|
576
|
-
}, [
|
|
577
|
-
options.serializer,
|
|
578
|
-
type
|
|
579
|
-
]);
|
|
573
|
+
var _options_serializer;
|
|
574
|
+
const serializer = (_options_serializer = options.serializer) != null ? _options_serializer : StorageSerializers[type];
|
|
580
575
|
const [state, setState] = useState(getInitialState$2(key, defaultValue, storage, serializer, onError));
|
|
581
|
-
|
|
576
|
+
useDeepCompareEffect(()=>{
|
|
582
577
|
const data = effectStorageValue ? isFunction(effectStorageValue) ? effectStorageValue() : effectStorageValue : defaultValue;
|
|
583
578
|
const getStoredValue = ()=>{
|
|
584
579
|
try {
|
|
@@ -594,7 +589,6 @@ function useStorage(key, defaultValue, getStorage = ()=>isBrowser ? sessionStora
|
|
|
594
589
|
}
|
|
595
590
|
};
|
|
596
591
|
setState(getStoredValue());
|
|
597
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
598
592
|
}, [
|
|
599
593
|
key,
|
|
600
594
|
serializer,
|