plain-design 1.0.0-beta.110 → 1.0.0-beta.111
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "plain-design",
|
3
|
-
"version": "1.0.0-beta.
|
3
|
+
"version": "1.0.0-beta.111",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/plain-design.min.js",
|
6
6
|
"module": "dist/plain-design.commonjs.min.js",
|
@@ -45,7 +45,7 @@
|
|
45
45
|
"@babel/preset-env": "7.23.7",
|
46
46
|
"@babel/preset-react": "7.23.3",
|
47
47
|
"@babel/preset-typescript": "7.23.3",
|
48
|
-
"@peryl/react-compose": "0.0.
|
48
|
+
"@peryl/react-compose": "0.0.204",
|
49
49
|
"@types/classnames": "^2.2.11",
|
50
50
|
"@types/react": "18.2.4",
|
51
51
|
"@types/react-dom": "18.2.4",
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import {getCurrentDesignInstance} from '@peryl/react-compose';
|
1
|
+
import {getCurrentDesignInstance, onBeforeUnmount} from '@peryl/react-compose';
|
2
|
+
import {delay} from "@peryl/utils/delay";
|
2
3
|
|
3
4
|
type Shift<T> = T extends [infer L, ...infer R] ? R : T
|
4
5
|
|
@@ -9,6 +10,7 @@ export function useFunctionWrapper<T extends (ctx: any, ...args: any[]) => any>(
|
|
9
10
|
return (...args) => {
|
10
11
|
const ctx = getCurrentDesignInstance() as any;
|
11
12
|
if (!ctx._use) ctx._use = {};
|
13
|
+
onBeforeUnmount(() => delay().then(() => {delete ctx._use;}));
|
12
14
|
|
13
15
|
if (!!ctx._use[key]) {
|
14
16
|
throw new Error(`use ${key} can only be executed once!`);
|