@alicloud/alfa-react 1.4.17 → 1.4.19
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.js +1 -1
- package/es/createApplication.js +24 -14
- package/es/version.js +1 -1
- package/lib/createApplication.js +24 -14
- package/lib/version.js +1 -1
- package/package.json +3 -3
- package/types/components/ErrorBoundary/index.d.ts +1 -1
- package/types/version.d.ts +1 -1
package/es/createApplication.js
CHANGED
|
@@ -43,8 +43,8 @@ export default function createApplication(loader) {
|
|
|
43
43
|
|
|
44
44
|
var _useState = useState(null),
|
|
45
45
|
_useState2 = _slicedToArray(_useState, 2),
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
appInstance = _useState2[0],
|
|
47
|
+
setAppInstance = _useState2[1];
|
|
48
48
|
|
|
49
49
|
var _useState3 = useState(null),
|
|
50
50
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
@@ -99,6 +99,7 @@ export default function createApplication(loader) {
|
|
|
99
99
|
};
|
|
100
100
|
}, []);
|
|
101
101
|
useEffect(function () {
|
|
102
|
+
var isUnmounted = false;
|
|
102
103
|
var App;
|
|
103
104
|
|
|
104
105
|
_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
@@ -119,21 +120,29 @@ export default function createApplication(loader) {
|
|
|
119
120
|
_yield$loader$registe = _context.sent;
|
|
120
121
|
app = _yield$loader$registe.app;
|
|
121
122
|
logger = _yield$loader$registe.logger;
|
|
122
|
-
App = app;
|
|
123
|
+
App = app; // container has been unmounted
|
|
123
124
|
|
|
124
|
-
if (
|
|
125
|
+
if (!isUnmounted) {
|
|
125
126
|
_context.next = 8;
|
|
126
127
|
break;
|
|
127
128
|
}
|
|
128
129
|
|
|
130
|
+
return _context.abrupt("return");
|
|
131
|
+
|
|
132
|
+
case 8:
|
|
133
|
+
if (app) {
|
|
134
|
+
_context.next = 10;
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
|
|
129
138
|
return _context.abrupt("return", (logger === null || logger === void 0 ? void 0 : logger.error) && logger.error({
|
|
130
139
|
E_CODE: 'RuntimeError',
|
|
131
140
|
E_MSG: 'load app failed.'
|
|
132
141
|
}));
|
|
133
142
|
|
|
134
|
-
case
|
|
143
|
+
case 10:
|
|
135
144
|
if (appRef.current) {
|
|
136
|
-
_context.next =
|
|
145
|
+
_context.next = 12;
|
|
137
146
|
break;
|
|
138
147
|
}
|
|
139
148
|
|
|
@@ -142,18 +151,18 @@ export default function createApplication(loader) {
|
|
|
142
151
|
E_MSG: 'cannot find container.'
|
|
143
152
|
}));
|
|
144
153
|
|
|
145
|
-
case
|
|
154
|
+
case 12:
|
|
146
155
|
// update body in sandbox context
|
|
147
156
|
(_app$context$updateBo = (_app$context = app.context).updateBody) === null || _app$context$updateBo === void 0 ? void 0 : _app$context$updateBo.call(_app$context, memoOptions.sandbox.disableFakeBody ? document.body : appRef.current);
|
|
148
|
-
_context.next =
|
|
157
|
+
_context.next = 15;
|
|
149
158
|
return app.mount(appRef.current, {
|
|
150
159
|
customProps: customProps
|
|
151
160
|
});
|
|
152
161
|
|
|
153
|
-
case
|
|
154
|
-
|
|
162
|
+
case 15:
|
|
163
|
+
setAppInstance(app);
|
|
155
164
|
|
|
156
|
-
case
|
|
165
|
+
case 16:
|
|
157
166
|
case "end":
|
|
158
167
|
return _context.stop();
|
|
159
168
|
}
|
|
@@ -166,12 +175,13 @@ export default function createApplication(loader) {
|
|
|
166
175
|
});
|
|
167
176
|
|
|
168
177
|
return function () {
|
|
178
|
+
isUnmounted = true;
|
|
169
179
|
App && App.unmount();
|
|
170
180
|
};
|
|
171
181
|
}, [memoOptions]);
|
|
172
182
|
|
|
173
|
-
if (
|
|
174
|
-
|
|
183
|
+
if (appInstance) {
|
|
184
|
+
appInstance.update(customProps);
|
|
175
185
|
}
|
|
176
186
|
|
|
177
187
|
var dataAttrs = {
|
|
@@ -179,7 +189,7 @@ export default function createApplication(loader) {
|
|
|
179
189
|
'data-version': version,
|
|
180
190
|
'data-loader': loaderVersion
|
|
181
191
|
};
|
|
182
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, !
|
|
192
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !appInstance ? /*#__PURE__*/React.createElement(Loading, {
|
|
183
193
|
loading: loading
|
|
184
194
|
}) : null, sandbox && sandbox.disableFakeBody ? /*#__PURE__*/React.createElement(tagName, _objectSpread({
|
|
185
195
|
style: style,
|
package/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var version = '1.4.
|
|
1
|
+
export var version = '1.4.19';
|
package/lib/createApplication.js
CHANGED
|
@@ -65,8 +65,8 @@ function createApplication(loader) {
|
|
|
65
65
|
|
|
66
66
|
var _useState = (0, _react.useState)(null),
|
|
67
67
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
appInstance = _useState2[0],
|
|
69
|
+
setAppInstance = _useState2[1];
|
|
70
70
|
|
|
71
71
|
var _useState3 = (0, _react.useState)(null),
|
|
72
72
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
@@ -121,6 +121,7 @@ function createApplication(loader) {
|
|
|
121
121
|
};
|
|
122
122
|
}, []);
|
|
123
123
|
(0, _react.useEffect)(function () {
|
|
124
|
+
var isUnmounted = false;
|
|
124
125
|
var App;
|
|
125
126
|
(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
126
127
|
var _app$context$updateBo, _app$context;
|
|
@@ -140,21 +141,29 @@ function createApplication(loader) {
|
|
|
140
141
|
_yield$loader$registe = _context.sent;
|
|
141
142
|
app = _yield$loader$registe.app;
|
|
142
143
|
logger = _yield$loader$registe.logger;
|
|
143
|
-
App = app;
|
|
144
|
+
App = app; // container has been unmounted
|
|
144
145
|
|
|
145
|
-
if (
|
|
146
|
+
if (!isUnmounted) {
|
|
146
147
|
_context.next = 8;
|
|
147
148
|
break;
|
|
148
149
|
}
|
|
149
150
|
|
|
151
|
+
return _context.abrupt("return");
|
|
152
|
+
|
|
153
|
+
case 8:
|
|
154
|
+
if (app) {
|
|
155
|
+
_context.next = 10;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
|
|
150
159
|
return _context.abrupt("return", (logger === null || logger === void 0 ? void 0 : logger.error) && logger.error({
|
|
151
160
|
E_CODE: 'RuntimeError',
|
|
152
161
|
E_MSG: 'load app failed.'
|
|
153
162
|
}));
|
|
154
163
|
|
|
155
|
-
case
|
|
164
|
+
case 10:
|
|
156
165
|
if (appRef.current) {
|
|
157
|
-
_context.next =
|
|
166
|
+
_context.next = 12;
|
|
158
167
|
break;
|
|
159
168
|
}
|
|
160
169
|
|
|
@@ -163,18 +172,18 @@ function createApplication(loader) {
|
|
|
163
172
|
E_MSG: 'cannot find container.'
|
|
164
173
|
}));
|
|
165
174
|
|
|
166
|
-
case
|
|
175
|
+
case 12:
|
|
167
176
|
// update body in sandbox context
|
|
168
177
|
(_app$context$updateBo = (_app$context = app.context).updateBody) === null || _app$context$updateBo === void 0 ? void 0 : _app$context$updateBo.call(_app$context, memoOptions.sandbox.disableFakeBody ? document.body : appRef.current);
|
|
169
|
-
_context.next =
|
|
178
|
+
_context.next = 15;
|
|
170
179
|
return app.mount(appRef.current, {
|
|
171
180
|
customProps: customProps
|
|
172
181
|
});
|
|
173
182
|
|
|
174
|
-
case
|
|
175
|
-
|
|
183
|
+
case 15:
|
|
184
|
+
setAppInstance(app);
|
|
176
185
|
|
|
177
|
-
case
|
|
186
|
+
case 16:
|
|
178
187
|
case "end":
|
|
179
188
|
return _context.stop();
|
|
180
189
|
}
|
|
@@ -186,12 +195,13 @@ function createApplication(loader) {
|
|
|
186
195
|
});
|
|
187
196
|
});
|
|
188
197
|
return function () {
|
|
198
|
+
isUnmounted = true;
|
|
189
199
|
App && App.unmount();
|
|
190
200
|
};
|
|
191
201
|
}, [memoOptions]);
|
|
192
202
|
|
|
193
|
-
if (
|
|
194
|
-
|
|
203
|
+
if (appInstance) {
|
|
204
|
+
appInstance.update(customProps);
|
|
195
205
|
}
|
|
196
206
|
|
|
197
207
|
var dataAttrs = {
|
|
@@ -199,7 +209,7 @@ function createApplication(loader) {
|
|
|
199
209
|
'data-version': version,
|
|
200
210
|
'data-loader': _version.version
|
|
201
211
|
};
|
|
202
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !
|
|
212
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !appInstance ? /*#__PURE__*/_react.default.createElement(_Loading.default, {
|
|
203
213
|
loading: loading
|
|
204
214
|
}) : null, sandbox && sandbox.disableFakeBody ? /*#__PURE__*/_react.default.createElement(tagName, _objectSpread({
|
|
205
215
|
style: style,
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alicloud/alfa-react",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.19",
|
|
4
4
|
"description": "Alfa Framework (React Version)",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"typescript": "^3.0.3"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@alicloud/alfa-core": "^1.4.
|
|
45
|
+
"@alicloud/alfa-core": "^1.4.19",
|
|
46
46
|
"@alicloud/console-os-loader": "^1.4.14-alpha.1",
|
|
47
47
|
"@alicloud/widget-utils-console": "^0.1.6",
|
|
48
48
|
"classnames": "^2.2.6",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"react": "^16 | ^17"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "d1ecada612cd3864854c775a04665f00a4f8b05c"
|
|
55
55
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ErrorInfo } from 'react';
|
|
2
2
|
import { AlfaLogger } from '@alicloud/alfa-core';
|
|
3
3
|
interface IProps {
|
|
4
|
-
fallbackRender?: (error?: Error) =>
|
|
4
|
+
fallbackRender?: (error?: Error) => React.ReactNode;
|
|
5
5
|
appDidCatch?: (error?: Error, info?: ErrorInfo) => void;
|
|
6
6
|
logger?: AlfaLogger;
|
|
7
7
|
}
|
package/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.4.
|
|
1
|
+
export declare const version = "1.4.19";
|