@modern-js/plugin-garfish 2.68.13-alpha.3 → 2.68.13

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.
@@ -57,6 +57,9 @@ function pathJoin(...args) {
57
57
  }
58
58
  function getAppInstance(options, appInfo, manifest) {
59
59
  let locationHref = "";
60
+ const componentSetterRegistry = {
61
+ current: null
62
+ };
60
63
  function MicroApp(props) {
61
64
  var _context_router, _context_router1, _context_router2, _context_router3, _context_router4;
62
65
  const appRef = (0, import_react.useRef)(null);
@@ -126,6 +129,7 @@ or directly pass the "basename":
126
129
  location
127
130
  ]);
128
131
  (0, import_react.useEffect)(() => {
132
+ componentSetterRegistry.current = setSubModuleComponent;
129
133
  const { setLoadingState, ...userProps } = props;
130
134
  const loadAppOptions = {
131
135
  cache: true,
@@ -147,9 +151,13 @@ or directly pass the "basename":
147
151
  return {
148
152
  mount: (...props2) => {
149
153
  if (componetRenderMode && SubComponent) {
150
- setSubModuleComponent({
151
- component: SubComponent
152
- });
154
+ if (componentSetterRegistry.current) {
155
+ componentSetterRegistry.current({
156
+ component: SubComponent
157
+ });
158
+ } else {
159
+ (0, import_util.logger)(`[Garfish] MicroApp for "${appInfo.name}" tried to mount, but no active component setter was found.`);
160
+ }
153
161
  return void 0;
154
162
  } else {
155
163
  (0, import_util.logger)("MicroApp customer render", props2);
@@ -205,6 +213,7 @@ or directly pass the "basename":
205
213
  }
206
214
  renderApp();
207
215
  return () => {
216
+ componentSetterRegistry.current = null;
208
217
  if (appRef.current) {
209
218
  const { appInfo: appInfo2 } = appRef.current;
210
219
  if (appInfo2.cache) {
@@ -33,6 +33,9 @@ function pathJoin() {
33
33
  }
34
34
  function getAppInstance(options, appInfo, manifest) {
35
35
  var locationHref = "";
36
+ var componentSetterRegistry = {
37
+ current: null
38
+ };
36
39
  function MicroApp(props) {
37
40
  var _context_router, _context_router1, _context_router2, _context_router3, _context_router4;
38
41
  var appRef = useRef(null);
@@ -103,6 +106,7 @@ or directly pass the "basename":
103
106
  var renderApp = function renderApp2() {
104
107
  return _renderApp.apply(this, arguments);
105
108
  };
109
+ componentSetterRegistry.current = setSubModuleComponent;
106
110
  var setLoadingState = props.setLoadingState, userProps = _object_without_properties(props, [
107
111
  "setLoadingState"
108
112
  ]);
@@ -125,9 +129,13 @@ or directly pass the "basename":
125
129
  _$props[_key] = arguments[_key];
126
130
  }
127
131
  if (componetRenderMode && SubComponent) {
128
- setSubModuleComponent({
129
- component: SubComponent
130
- });
132
+ if (componentSetterRegistry.current) {
133
+ componentSetterRegistry.current({
134
+ component: SubComponent
135
+ });
136
+ } else {
137
+ logger('[Garfish] MicroApp for "'.concat(appInfo.name, '" tried to mount, but no active component setter was found.'));
138
+ }
131
139
  return void 0;
132
140
  } else {
133
141
  logger("MicroApp customer render", _$props);
@@ -236,6 +244,7 @@ or directly pass the "basename":
236
244
  }
237
245
  renderApp();
238
246
  return function() {
247
+ componentSetterRegistry.current = null;
239
248
  if (appRef.current) {
240
249
  var _$appInfo = appRef.current.appInfo;
241
250
  if (_$appInfo.cache) {
@@ -23,6 +23,9 @@ function pathJoin(...args) {
23
23
  }
24
24
  function getAppInstance(options, appInfo, manifest) {
25
25
  let locationHref = "";
26
+ const componentSetterRegistry = {
27
+ current: null
28
+ };
26
29
  function MicroApp(props) {
27
30
  var _context_router, _context_router1, _context_router2, _context_router3, _context_router4;
28
31
  const appRef = useRef(null);
@@ -92,6 +95,7 @@ or directly pass the "basename":
92
95
  location
93
96
  ]);
94
97
  useEffect(() => {
98
+ componentSetterRegistry.current = setSubModuleComponent;
95
99
  const { setLoadingState, ...userProps } = props;
96
100
  const loadAppOptions = {
97
101
  cache: true,
@@ -113,9 +117,13 @@ or directly pass the "basename":
113
117
  return {
114
118
  mount: (...props2) => {
115
119
  if (componetRenderMode && SubComponent) {
116
- setSubModuleComponent({
117
- component: SubComponent
118
- });
120
+ if (componentSetterRegistry.current) {
121
+ componentSetterRegistry.current({
122
+ component: SubComponent
123
+ });
124
+ } else {
125
+ logger(`[Garfish] MicroApp for "${appInfo.name}" tried to mount, but no active component setter was found.`);
126
+ }
119
127
  return void 0;
120
128
  } else {
121
129
  logger("MicroApp customer render", props2);
@@ -171,6 +179,7 @@ or directly pass the "basename":
171
179
  }
172
180
  renderApp();
173
181
  return () => {
182
+ componentSetterRegistry.current = null;
174
183
  if (appRef.current) {
175
184
  const { appInfo: appInfo2 } = appRef.current;
176
185
  if (appInfo2.cache) {
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.68.13-alpha.3",
18
+ "version": "2.68.13",
19
19
  "jsnext:source": "./src/cli/index.ts",
20
20
  "types": "./dist/types/cli/index.d.ts",
21
21
  "typesVersions": {
@@ -69,12 +69,12 @@
69
69
  "debug": "4.3.7",
70
70
  "garfish": "^1.8.1",
71
71
  "react-loadable": "^5.5.0",
72
- "@modern-js/plugin-v2": "2.68.12",
73
- "@modern-js/runtime-utils": "2.68.12",
74
- "@modern-js/utils": "2.68.12"
72
+ "@modern-js/plugin-v2": "2.68.13",
73
+ "@modern-js/runtime-utils": "2.68.13",
74
+ "@modern-js/utils": "2.68.13"
75
75
  },
76
76
  "peerDependencies": {
77
- "@modern-js/runtime": "^2.68.12",
77
+ "@modern-js/runtime": "^2.68.13",
78
78
  "react": ">=17",
79
79
  "react-dom": ">=17"
80
80
  },
@@ -93,13 +93,13 @@
93
93
  "react-dom": "^18.3.1",
94
94
  "react-router-dom": "6.27.0",
95
95
  "typescript": "^5",
96
- "@modern-js/app-tools": "2.68.12",
97
- "@modern-js/core": "2.68.12",
98
- "@modern-js/runtime": "2.68.12",
99
- "@modern-js/types": "2.68.12",
96
+ "@modern-js/app-tools": "2.68.13",
97
+ "@modern-js/core": "2.68.13",
98
+ "@modern-js/plugin-router-v5": "2.68.13",
99
+ "@modern-js/runtime": "2.68.13",
100
+ "@modern-js/types": "2.68.13",
100
101
  "@scripts/build": "2.66.0",
101
- "@scripts/jest-config": "2.66.0",
102
- "@modern-js/plugin-router-v5": "2.68.12"
102
+ "@scripts/jest-config": "2.66.0"
103
103
  },
104
104
  "sideEffects": false,
105
105
  "publishConfig": {