Skip to content

Commit c6abd56

Browse files
authored
fix(qiankun): 修复 prefetch 对数组配置支持不完善的问题 (#723)
1 parent 82a4e78 commit c6abd56

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ node_modules
77
.umi-test
88
.umi-production
99
.DS_Store
10+
.idea

packages/plugin-qiankun/src/master/MicroApp.tsx.tpl

+9-2
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,15 @@ export const MicroApp = forwardRef(
149149
if (prefetch && prefetch !== 'all' && noneMounted) {
150150
microAppRef.current?.mountPromise.then(() => {
151151
if (noneMounted) {
152-
const otherNotMountedApps = apps.filter((app) => app.name !== name);
153-
prefetchApps(otherNotMountedApps, configuration);
152+
if (Array.isArray(prefetch)) {
153+
const specialPrefetchApps = apps.filter(
154+
(app) => app.name !== name && prefetch.indexOf(app.name) !== -1,
155+
);
156+
prefetchApps(specialPrefetchApps, configuration);
157+
} else {
158+
const otherNotMountedApps = apps.filter((app) => app.name !== name);
159+
prefetchApps(otherNotMountedApps, configuration);
160+
}
154161
noneMounted = false;
155162
}
156163
});

yarn.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -6830,7 +6830,7 @@ dateformat@^3.0.0:
68306830
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
68316831
integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==
68326832

6833-
[email protected], dayjs@^1.10.3, dayjs@^1.10.4, dayjs@^1.10.6:
6833+
[email protected], dayjs@^1.10.3, dayjs@^1.10.4:
68346834
version "1.10.6"
68356835
resolved "https://registry.nlark.com/dayjs/download/dayjs-1.10.6.tgz?cache=0&sync_timestamp=1625557417200&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdayjs%2Fdownload%2Fdayjs-1.10.6.tgz#288b2aa82f2d8418a6c9d4df5898c0737ad02a63"
68366836
integrity sha1-KIsqqC8thBimydTfWJjAc3rQKmM=

0 commit comments

Comments
 (0)