@umijs/plugins 4.0.35 → 4.0.37

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/mf.js CHANGED
@@ -71,7 +71,7 @@ function mf(api) {
71
71
  const mfConfig = {
72
72
  name,
73
73
  remotes,
74
- filename: "remote.js",
74
+ filename: api.config.hash ? "remote.[contenthash:8].js" : "remote.js",
75
75
  exposes,
76
76
  shared,
77
77
  library: api.config.mf.library
package/libs/model.tsx CHANGED
@@ -160,6 +160,8 @@ export function useModel<N extends Namespaces, S>(
160
160
  : data;
161
161
  const previousState = stateRef.current;
162
162
  if (!isEqual(currentState, previousState)) {
163
+ // 避免 currentState 拿到的数据是老的,从而导致 isEqual 比对逻辑有问题
164
+ stateRef.current = currentState;
163
165
  setState(currentState);
164
166
  }
165
167
  }
@@ -262,16 +262,19 @@ export const MicroApp = forwardRef(
262
262
  ? (loading) => <MicroAppLoader loading={loading} />
263
263
  : null);
264
264
 
265
+ const microAppWrapperClassName = wrapperClassName ? `${wrapperClassName} qiankun-micro-app-wrapper` : 'qiankun-micro-app-wrapper';
266
+ const microAppClassName = className ? `${className} qiankun-micro-app-container` : 'qiankun-micro-app-container';
267
+
265
268
  return Boolean(microAppLoader) || Boolean(microAppErrorBoundary) ? (
266
- <div style={{ position: 'relative' }} className={wrapperClassName}>
269
+ <div style={{ position: 'relative' }} className={microAppWrapperClassName}>
267
270
  {Boolean(microAppLoader) && microAppLoader(loading)}
268
271
  {Boolean(microAppErrorBoundary) &&
269
272
  Boolean(error) &&
270
273
  microAppErrorBoundary(error)}
271
- <div ref={containerRef} className={className} />
274
+ <div ref={containerRef} className={microAppClassName} />
272
275
  </div>
273
276
  ) : (
274
- <div ref={containerRef} className={className} />
277
+ <div ref={containerRef} className={microAppClassName} />
275
278
  );
276
279
  },
277
280
  );
@@ -9,15 +9,22 @@ export function render(oldRender: any) {
9
9
  export function modifyClientRenderOpts(memo: any) {
10
10
  // 每次应用 render 的时候会调 modifyClientRenderOpts,这时尝试从队列中取 render 的配置
11
11
  const clientRenderOpts = contextOptsStack.shift();
12
- if (clientRenderOpts) {
12
+ const { basename, historyType } = memo;
13
+
14
+ const newBasename = clientRenderOpts?.basename || basename;
15
+ const newHistoryType = clientRenderOpts?.historyType || historyType;
16
+
17
+ if (newHistoryType !== historyType || newBasename !== basename) {
13
18
  clientRenderOpts.history = createHistory({
14
- type: clientRenderOpts.historyType,
15
- basename: clientRenderOpts.basename,
19
+ type: newHistoryType,
20
+ basename: newBasename,
16
21
  ...clientRenderOpts.historyOpts,
17
22
  });
18
23
  }
19
24
  return {
20
25
  ...memo,
21
26
  ...clientRenderOpts,
27
+ basename: newBasename,
28
+ historyType: newHistoryType,
22
29
  };
23
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/plugins",
3
- "version": "4.0.35",
3
+ "version": "4.0.37",
4
4
  "description": "@umijs/plugins",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/plugins#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",
@@ -27,7 +27,7 @@
27
27
  "@ant-design/antd-theme-variable": "^1.0.0",
28
28
  "@ant-design/icons": "^4.7.0",
29
29
  "@ant-design/pro-components": "^2.0.1",
30
- "@umijs/bundler-utils": "4.0.35",
30
+ "@umijs/bundler-utils": "4.0.37",
31
31
  "@umijs/valtio": "^1.0.2",
32
32
  "antd-dayjs-webpack-plugin": "^1.0.6",
33
33
  "axios": "^0.27.2",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "devDependencies": {
52
52
  "antd": "^4.24.1",
53
- "umi": "4.0.35"
53
+ "umi": "4.0.37"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public"