@modern-js/plugin-garfish 2.68.19-alpha.2 → 2.68.19-alpha.3

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.
@@ -96,6 +96,7 @@ function getAppInstance(options, appInfo, manifest) {
96
96
  const previousPropsRef = (0, import_react.useRef)(props);
97
97
  const propsUpdateCounterRef = (0, import_react.useRef)(0);
98
98
  const domId = (0, import_util.generateSubAppContainerKey)(appInfo);
99
+ const componentRef = (0, import_react.useRef)(null);
99
100
  const [{ component: SubModuleComponent, isFromJupiter }, setSubModuleComponent] = (0, import_react.useState)({
100
101
  component: null,
101
102
  isFromJupiter: false
@@ -219,6 +220,7 @@ or directly pass the "basename":
219
220
  mount: (...props2) => {
220
221
  if (componetRenderMode && SubComponent) {
221
222
  if (componentSetterRegistry.current) {
223
+ componentRef.current = SubComponent;
222
224
  componentSetterRegistry.current({
223
225
  component: SubComponent,
224
226
  isFromJupiter: isFromJupiter2
@@ -315,6 +317,39 @@ or directly pass the "basename":
315
317
  propsUpdateKey,
316
318
  props
317
319
  ]);
320
+ (0, import_react.useEffect)(() => {
321
+ var _appRef_current;
322
+ const componetRenderMode = manifest === null || manifest === void 0 ? void 0 : manifest.componentRender;
323
+ if (componetRenderMode && ((_appRef_current = appRef.current) === null || _appRef_current === void 0 ? void 0 : _appRef_current.mounted)) {
324
+ const componentToUse = SubModuleComponent || componentRef.current;
325
+ if (componentToUse) {
326
+ const currentComponent = componentToUse;
327
+ const currentIsFromJupiter = isFromJupiter;
328
+ setSubModuleComponent({
329
+ component: null,
330
+ isFromJupiter: false
331
+ });
332
+ setTimeout(() => {
333
+ setSubModuleComponent({
334
+ component: currentComponent,
335
+ isFromJupiter: currentIsFromJupiter
336
+ });
337
+ }, 50);
338
+ } else {
339
+ var _appRef_current1;
340
+ if ((_appRef_current1 = appRef.current) === null || _appRef_current1 === void 0 ? void 0 : _appRef_current1.mounted) {
341
+ var _appRef_current2;
342
+ (_appRef_current2 = appRef.current) === null || _appRef_current2 === void 0 ? void 0 : _appRef_current2.hide();
343
+ setTimeout(() => {
344
+ var _appRef_current3;
345
+ (_appRef_current3 = appRef.current) === null || _appRef_current3 === void 0 ? void 0 : _appRef_current3.show();
346
+ }, 10);
347
+ }
348
+ }
349
+ }
350
+ }, [
351
+ propsUpdateKey
352
+ ]);
318
353
  const { setLoadingState, ...renderProps } = props;
319
354
  const finalRenderProps = {
320
355
  ...renderProps,
@@ -94,6 +94,7 @@ function getAppInstance(options, appInfo, manifest) {
94
94
  var previousPropsRef = useRef(props);
95
95
  var propsUpdateCounterRef = useRef(0);
96
96
  var domId = generateSubAppContainerKey(appInfo);
97
+ var componentRef = useRef(null);
97
98
  var _useState = _sliced_to_array(useState({
98
99
  component: null,
99
100
  isFromJupiter: false
@@ -217,6 +218,7 @@ or directly pass the "basename":
217
218
  }
218
219
  if (componetRenderMode && SubComponent) {
219
220
  if (componentSetterRegistry.current) {
221
+ componentRef.current = SubComponent;
220
222
  componentSetterRegistry.current({
221
223
  component: SubComponent,
222
224
  isFromJupiter: isFromJupiter2
@@ -366,6 +368,39 @@ or directly pass the "basename":
366
368
  propsUpdateKey,
367
369
  props
368
370
  ]);
371
+ useEffect(function() {
372
+ var _appRef_current;
373
+ var componetRenderMode = manifest === null || manifest === void 0 ? void 0 : manifest.componentRender;
374
+ if (componetRenderMode && ((_appRef_current = appRef.current) === null || _appRef_current === void 0 ? void 0 : _appRef_current.mounted)) {
375
+ var componentToUse = SubModuleComponent || componentRef.current;
376
+ if (componentToUse) {
377
+ var currentComponent = componentToUse;
378
+ var currentIsFromJupiter = isFromJupiter;
379
+ setSubModuleComponent({
380
+ component: null,
381
+ isFromJupiter: false
382
+ });
383
+ setTimeout(function() {
384
+ setSubModuleComponent({
385
+ component: currentComponent,
386
+ isFromJupiter: currentIsFromJupiter
387
+ });
388
+ }, 50);
389
+ } else {
390
+ var _appRef_current1;
391
+ if ((_appRef_current1 = appRef.current) === null || _appRef_current1 === void 0 ? void 0 : _appRef_current1.mounted) {
392
+ var _appRef_current2;
393
+ (_appRef_current2 = appRef.current) === null || _appRef_current2 === void 0 ? void 0 : _appRef_current2.hide();
394
+ setTimeout(function() {
395
+ var _appRef_current3;
396
+ (_appRef_current3 = appRef.current) === null || _appRef_current3 === void 0 ? void 0 : _appRef_current3.show();
397
+ }, 10);
398
+ }
399
+ }
400
+ }
401
+ }, [
402
+ propsUpdateKey
403
+ ]);
369
404
  var setLoadingState = props.setLoadingState, renderProps = _object_without_properties(props, [
370
405
  "setLoadingState"
371
406
  ]);
@@ -62,6 +62,7 @@ function getAppInstance(options, appInfo, manifest) {
62
62
  const previousPropsRef = useRef(props);
63
63
  const propsUpdateCounterRef = useRef(0);
64
64
  const domId = generateSubAppContainerKey(appInfo);
65
+ const componentRef = useRef(null);
65
66
  const [{ component: SubModuleComponent, isFromJupiter }, setSubModuleComponent] = useState({
66
67
  component: null,
67
68
  isFromJupiter: false
@@ -185,6 +186,7 @@ or directly pass the "basename":
185
186
  mount: (...props2) => {
186
187
  if (componetRenderMode && SubComponent) {
187
188
  if (componentSetterRegistry.current) {
189
+ componentRef.current = SubComponent;
188
190
  componentSetterRegistry.current({
189
191
  component: SubComponent,
190
192
  isFromJupiter: isFromJupiter2
@@ -281,6 +283,39 @@ or directly pass the "basename":
281
283
  propsUpdateKey,
282
284
  props
283
285
  ]);
286
+ useEffect(() => {
287
+ var _appRef_current;
288
+ const componetRenderMode = manifest === null || manifest === void 0 ? void 0 : manifest.componentRender;
289
+ if (componetRenderMode && ((_appRef_current = appRef.current) === null || _appRef_current === void 0 ? void 0 : _appRef_current.mounted)) {
290
+ const componentToUse = SubModuleComponent || componentRef.current;
291
+ if (componentToUse) {
292
+ const currentComponent = componentToUse;
293
+ const currentIsFromJupiter = isFromJupiter;
294
+ setSubModuleComponent({
295
+ component: null,
296
+ isFromJupiter: false
297
+ });
298
+ setTimeout(() => {
299
+ setSubModuleComponent({
300
+ component: currentComponent,
301
+ isFromJupiter: currentIsFromJupiter
302
+ });
303
+ }, 50);
304
+ } else {
305
+ var _appRef_current1;
306
+ if ((_appRef_current1 = appRef.current) === null || _appRef_current1 === void 0 ? void 0 : _appRef_current1.mounted) {
307
+ var _appRef_current2;
308
+ (_appRef_current2 = appRef.current) === null || _appRef_current2 === void 0 ? void 0 : _appRef_current2.hide();
309
+ setTimeout(() => {
310
+ var _appRef_current3;
311
+ (_appRef_current3 = appRef.current) === null || _appRef_current3 === void 0 ? void 0 : _appRef_current3.show();
312
+ }, 10);
313
+ }
314
+ }
315
+ }
316
+ }, [
317
+ propsUpdateKey
318
+ ]);
284
319
  const { setLoadingState, ...renderProps } = props;
285
320
  const finalRenderProps = {
286
321
  ...renderProps,
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.68.19-alpha.2",
18
+ "version": "2.68.19-alpha.3",
19
19
  "jsnext:source": "./src/cli/index.ts",
20
20
  "types": "./dist/types/cli/index.d.ts",
21
21
  "typesVersions": {
@@ -70,8 +70,8 @@
70
70
  "garfish": "^1.8.1",
71
71
  "react-loadable": "^5.5.0",
72
72
  "@modern-js/plugin-v2": "2.68.18",
73
- "@modern-js/runtime-utils": "2.68.18",
74
- "@modern-js/utils": "2.68.18"
73
+ "@modern-js/utils": "2.68.18",
74
+ "@modern-js/runtime-utils": "2.68.18"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "@modern-js/runtime": "^2.68.18",
@@ -95,11 +95,11 @@
95
95
  "typescript": "^5",
96
96
  "@modern-js/app-tools": "2.68.18",
97
97
  "@scripts/build": "2.66.0",
98
- "@modern-js/core": "2.68.18",
98
+ "@modern-js/runtime": "2.68.18",
99
99
  "@modern-js/plugin-router-v5": "2.68.18",
100
100
  "@modern-js/types": "2.68.18",
101
- "@modern-js/runtime": "2.68.18",
102
- "@scripts/jest-config": "2.66.0"
101
+ "@scripts/jest-config": "2.66.0",
102
+ "@modern-js/core": "2.68.18"
103
103
  },
104
104
  "sideEffects": false,
105
105
  "publishConfig": {