From 2c58d515da51ea7d5a4dab1105a842c8003d7a0e Mon Sep 17 00:00:00 2001 From: ChengLei Shao Date: Sun, 5 Nov 2023 19:36:53 +0800 Subject: [PATCH] chore: destory collection in share collection plugin (#2968) --- .../plugin-multi-app-share-collection/src/server/plugin.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/plugins/@nocobase/plugin-multi-app-share-collection/src/server/plugin.ts b/packages/plugins/@nocobase/plugin-multi-app-share-collection/src/server/plugin.ts index 655dea1f1c..ff64f811ec 100644 --- a/packages/plugins/@nocobase/plugin-multi-app-share-collection/src/server/plugin.ts +++ b/packages/plugins/@nocobase/plugin-multi-app-share-collection/src/server/plugin.ts @@ -237,7 +237,9 @@ export class MultiAppShareCollectionPlugin extends Plugin { this.app.db.on(`afterRemoveCollection`, (collection) => { const subApps = [...AppSupervisor.getInstance().subApps()]; for (const subApp of subApps) { - subApp.db.removeCollection(collection.name); + if (subApp.db.hasCollection(collection.name)) { + subApp.db.removeCollection(collection.name); + } } }); }