diff --git a/packages/plugins/multi-app-share-collection/src/server/__tests__/collection-sync.test.ts b/packages/plugins/multi-app-share-collection/src/server/__tests__/collection-sync.test.ts index 7a2a58b238..90f7f644f6 100644 --- a/packages/plugins/multi-app-share-collection/src/server/__tests__/collection-sync.test.ts +++ b/packages/plugins/multi-app-share-collection/src/server/__tests__/collection-sync.test.ts @@ -99,7 +99,7 @@ pgOnly()('collection sync', () => { const sub1 = await mainApp.appManager.getApplication('sub1'); - const getSub1MapRecord = async (app) => { + const getSubAppMapRecord = async (app) => { return await app.db.getRepository('applicationPlugins').findOne({ filter: { name: 'map', @@ -107,10 +107,10 @@ pgOnly()('collection sync', () => { }); }; - expect((await getSub1MapRecord(sub1)).get('enabled')).toBeFalsy(); + expect((await getSubAppMapRecord(sub1)).get('enabled')).toBeFalsy(); await mainApp.pm.enable('map'); - expect((await getSub1MapRecord(sub1)).get('enabled')).toBeTruthy(); + expect((await getSubAppMapRecord(sub1)).get('enabled')).toBeTruthy(); await mainApp.db.getRepository('applications').create({ values: { @@ -119,7 +119,7 @@ pgOnly()('collection sync', () => { }); const sub2 = await mainApp.appManager.getApplication('sub2'); - expect((await getSub1MapRecord(sub2)).get('enabled')).toBeTruthy(); + expect((await getSubAppMapRecord(sub2)).get('enabled')).toBeTruthy(); }); it('should not sync roles in sub app', async () => { diff --git a/packages/plugins/multi-app-share-collection/src/server/plugin.ts b/packages/plugins/multi-app-share-collection/src/server/plugin.ts index 36fb0c0274..b44fbe21b0 100644 --- a/packages/plugins/multi-app-share-collection/src/server/plugin.ts +++ b/packages/plugins/multi-app-share-collection/src/server/plugin.ts @@ -194,14 +194,6 @@ export class MultiAppShareCollectionPlugin extends Plugin { return; } - // 应用加载完之后,需要将子应用全部载入到内存中 - this.app.on('afterLoad', async () => { - const subApplications = await this.db.getRepository('applications').find(); - for (const subApplication of subApplications) { - await this.app.appManager.getApplication(subApplication.name); - } - }); - this.app.on('beforeSubAppInstall', async ({ subApp }) => { const subAppPluginsCollection = subApp.db.getCollection('applicationPlugins'); const mainAppPluginsCollection = this.app.db.getCollection('applicationPlugins');