@hairy/react-lib 1.16.0 → 1.18.0
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 +5 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.global.js +5 -3
- package/dist/index.js +5 -3
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -446,10 +446,12 @@ function track(action, status) {
|
|
|
446
446
|
tracking();
|
|
447
447
|
try {
|
|
448
448
|
const result = action(...args);
|
|
449
|
-
if (result instanceof Promise)
|
|
450
|
-
result.then(fulfilled).catch(rejected);
|
|
451
|
-
else
|
|
449
|
+
if (result instanceof Promise) {
|
|
450
|
+
return result.then(fulfilled).catch(rejected);
|
|
451
|
+
} else {
|
|
452
452
|
fulfilled();
|
|
453
|
+
return result;
|
|
454
|
+
}
|
|
453
455
|
} catch (error) {
|
|
454
456
|
rejected(error);
|
|
455
457
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -202,10 +202,10 @@ interface AsyncStoreOptions<T extends AnyFn> {
|
|
|
202
202
|
initial?: ReturnType<T> extends Promise<infer U> ? U : undefined;
|
|
203
203
|
persist?: string;
|
|
204
204
|
}
|
|
205
|
-
declare function defineAsyncStore<T extends AnyFn>(fetch:
|
|
205
|
+
declare function defineAsyncStore<T extends AnyFn>(fetch: T, options?: AsyncStoreOptions<T>): Store<{
|
|
206
206
|
value: (ReturnType<T> extends Promise<infer U> ? U : undefined) | undefined;
|
|
207
207
|
}, {
|
|
208
|
-
fetch:
|
|
208
|
+
fetch: T;
|
|
209
209
|
refresh(this: {
|
|
210
210
|
value: (ReturnType<T> extends Promise<infer U> ? U : undefined) | undefined;
|
|
211
211
|
}, value?: (ReturnType<T> extends Promise<infer U_1> ? U_1 : undefined)): void;
|
package/dist/index.global.js
CHANGED
|
@@ -1057,10 +1057,12 @@ var LibReact = (() => {
|
|
|
1057
1057
|
tracking();
|
|
1058
1058
|
try {
|
|
1059
1059
|
const result = action(...args);
|
|
1060
|
-
if (result instanceof Promise)
|
|
1061
|
-
result.then(fulfilled).catch(rejected);
|
|
1062
|
-
else
|
|
1060
|
+
if (result instanceof Promise) {
|
|
1061
|
+
return result.then(fulfilled).catch(rejected);
|
|
1062
|
+
} else {
|
|
1063
1063
|
fulfilled();
|
|
1064
|
+
return result;
|
|
1065
|
+
}
|
|
1064
1066
|
} catch (error) {
|
|
1065
1067
|
rejected(error);
|
|
1066
1068
|
}
|
package/dist/index.js
CHANGED
|
@@ -386,10 +386,12 @@ function track(action, status) {
|
|
|
386
386
|
tracking();
|
|
387
387
|
try {
|
|
388
388
|
const result = action(...args);
|
|
389
|
-
if (result instanceof Promise)
|
|
390
|
-
result.then(fulfilled).catch(rejected);
|
|
391
|
-
else
|
|
389
|
+
if (result instanceof Promise) {
|
|
390
|
+
return result.then(fulfilled).catch(rejected);
|
|
391
|
+
} else {
|
|
392
392
|
fulfilled();
|
|
393
|
+
return result;
|
|
394
|
+
}
|
|
393
395
|
} catch (error) {
|
|
394
396
|
rejected(error);
|
|
395
397
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hairy/react-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.18.0",
|
|
5
5
|
"description": "Library for react",
|
|
6
6
|
"author": "Hairyf <wwu710632@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"react-dom": "^18.2.0",
|
|
39
39
|
"react-i18next": "^14.1.2",
|
|
40
40
|
"react-use": "^17.6.0",
|
|
41
|
-
"@hairy/utils": "1.
|
|
41
|
+
"@hairy/utils": "1.18.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsup",
|