~repos /atoms-state
git clone https://pyrossh.dev/repos/atoms-state.git
Simple State management for react
6cdc58ce
—
Peter John 3 years ago
fix useAsyncStorage
- index.js +2 -0
- package.json +1 -1
index.js
CHANGED
|
@@ -184,6 +184,8 @@ export const useAsyncStorage = (key, initialValue) => {
|
|
|
184
184
|
.then((v) => {
|
|
185
185
|
if (v) {
|
|
186
186
|
setData(v);
|
|
187
|
+
} else {
|
|
188
|
+
setStoredValue({ ...initialValue, loading: false });
|
|
187
189
|
}
|
|
188
190
|
})
|
|
189
191
|
.catch(() => setStoredValue({ ...storedValue, loading: false }));
|
package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@pyros2097/atoms-state",
|
|
3
3
|
"author": "pyros.sh",
|
|
4
4
|
"description": "State management and common hooks",
|
|
5
|
-
"version": "0.7.
|
|
5
|
+
"version": "0.7.3",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "index.js",
|