@lark-apaas/client-toolkit 1.1.19-alpha.error.1 → 1.1.20
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.
|
@@ -21,9 +21,15 @@ const RenderError = (props)=>{
|
|
|
21
21
|
useEffect(()=>{
|
|
22
22
|
if (!resetErrorBoundary) return;
|
|
23
23
|
const hot = getModuleHot();
|
|
24
|
-
if (hot)
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
if (hot) {
|
|
25
|
+
const handler = createApplyHandle((success)=>{
|
|
26
|
+
if (success) resetErrorBoundary();
|
|
27
|
+
});
|
|
28
|
+
hot.addStatusHandler(handler);
|
|
29
|
+
return ()=>{
|
|
30
|
+
hot.removeStatusHandler(handler);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
27
33
|
}, [
|
|
28
34
|
resetErrorBoundary
|
|
29
35
|
]);
|
|
@@ -64,7 +64,7 @@ function processDevServerLog(log) {
|
|
|
64
64
|
}
|
|
65
65
|
function listenModuleHmr() {
|
|
66
66
|
const hot = getModuleHot();
|
|
67
|
-
if (hot) hot.addStatusHandler(createApplyHandle((success)=>{
|
|
67
|
+
if (hot) hot.addStatusHandler(createApplyHandle((success, status)=>{
|
|
68
68
|
if (success) submitPostMessage({
|
|
69
69
|
type: 'DevServerMessage',
|
|
70
70
|
data: {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
type ModuleHotType = 'idle' | 'check' | 'prepare' | 'ready' | 'dispose' | 'apply' | 'abort' | 'fail';
|
|
14
14
|
interface ModuleHotInstance {
|
|
15
15
|
addStatusHandler: (handler: (status: ModuleHotType) => void) => void;
|
|
16
|
+
removeStatusHandler: (handler: (status: ModuleHotType) => void) => void;
|
|
16
17
|
}
|
|
17
18
|
export declare function getModuleHot(): ModuleHotInstance | null;
|
|
18
19
|
/**
|
|
@@ -20,5 +21,5 @@ export declare function getModuleHot(): ModuleHotInstance | null;
|
|
|
20
21
|
* 监听模块热更状态,当状态为apply时,调用回调函数并传入true
|
|
21
22
|
* @param callback 热更成功回调函数,参数为是否成功
|
|
22
23
|
*/
|
|
23
|
-
export declare function createApplyHandle(callback: (success: boolean) => void): (status: ModuleHotType) => void;
|
|
24
|
+
export declare function createApplyHandle(callback: (success: boolean, status: ModuleHotType) => void): (status: ModuleHotType) => void;
|
|
24
25
|
export {};
|
package/lib/utils/module-hot.js
CHANGED
|
@@ -7,12 +7,12 @@ function createApplyHandle(callback) {
|
|
|
7
7
|
return (status)=>{
|
|
8
8
|
if ('fail' === status || 'abort' === status) {
|
|
9
9
|
hasApply = false;
|
|
10
|
-
return callback(false);
|
|
10
|
+
return callback(false, status);
|
|
11
11
|
}
|
|
12
12
|
if (hasApply) {
|
|
13
13
|
if ('idle' === status) {
|
|
14
14
|
hasApply = false;
|
|
15
|
-
callback(true);
|
|
15
|
+
callback(true, status);
|
|
16
16
|
}
|
|
17
17
|
return;
|
|
18
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/client-toolkit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.20",
|
|
4
4
|
"types": "./lib/index.d.ts",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@ant-design/colors": "^7.2.1",
|
|
77
77
|
"@ant-design/cssinjs": "^1.24.0",
|
|
78
78
|
"@data-loom/js": "^0.4.0",
|
|
79
|
-
"@lark-apaas/miaoda-inspector": "^1.0.
|
|
79
|
+
"@lark-apaas/miaoda-inspector": "^1.0.4",
|
|
80
80
|
"@radix-ui/react-avatar": "^1.1.10",
|
|
81
81
|
"@radix-ui/react-popover": "^1.1.15",
|
|
82
82
|
"@radix-ui/react-slot": "^1.2.3",
|