Skip to content

Commit 009b348

Browse files
authored
fix(core): fix loadApp lost appInfo information after the second merge (#575)
* fix lost appInfo information after the second merge in loadApp * tests(core): update tests for loadApp
1 parent d1eadd8 commit 009b348

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

packages/core/__tests__/loadApp.spec.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,8 @@ describe('Core: load process', () => {
174174
});
175175

176176
it('config provided by options in loadApp will have the highest priority after config merged', async () => {
177-
const mockBeforeLoad = jest.fn(() => {
178-
GarfishInstance.appInfos['vue-app'] = {
179-
name: 'vue-app',
180-
entry: vue3SubAppEntry,
181-
};
177+
const mockBeforeLoad = jest.fn((appInfo) => {
178+
appInfo.entry = vue3SubAppEntry;
182179
});
183180

184181
GarfishInstance.run({
@@ -195,10 +192,16 @@ describe('Core: load process', () => {
195192
await expect(
196193
GarfishInstance.loadApp('vue-app', {
197194
domGetter: '#container',
195+
props: {
196+
aaa: '123'
197+
}
198198
}),
199199
).resolves.toMatchObject({
200200
appInfo: {
201201
entry: vue3SubAppEntry,
202+
props: {
203+
aaa: '123'
204+
}
202205
},
203206
});
204207

packages/core/src/garfish.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export class Garfish extends EventEmitter2 {
173173
}
174174

175175
//merge configs again after beforeLoad for the reason of app may be re-registered during beforeLoad resulting in an incorrect information
176-
appInfo = generateAppOptions(appName, this, options);
176+
appInfo = generateAppOptions(appName, this, appInfo);
177177

178178
assert(
179179
appInfo.entry,

0 commit comments

Comments
 (0)