@nocobase/plugin-collection-tree 1.9.0-beta.6 → 1.9.0-beta.8

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.
@@ -8,11 +8,11 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.9.0-beta.6",
12
- "@nocobase/database": "1.9.0-beta.6",
13
- "@nocobase/utils": "1.9.0-beta.6",
11
+ "@nocobase/client": "1.9.0-beta.8",
12
+ "@nocobase/database": "1.9.0-beta.8",
13
+ "@nocobase/utils": "1.9.0-beta.8",
14
14
  "lodash": "4.17.21",
15
- "@nocobase/data-source-manager": "1.9.0-beta.6",
16
- "@nocobase/server": "1.9.0-beta.6",
15
+ "@nocobase/data-source-manager": "1.9.0-beta.8",
16
+ "@nocobase/server": "1.9.0-beta.8",
17
17
  "sequelize": "6.35.2"
18
18
  };
@@ -123,19 +123,25 @@ class PluginCollectionTreeServer extends import_server.Plugin {
123
123
  throw new Error("Cannot set itself as the parent node");
124
124
  }
125
125
  });
126
+ this.db.on("collections.afterDestroy", async (collection2, { transaction }) => {
127
+ const name2 = `main_${collection2.get("name")}_path`;
128
+ if (!condition(collection2.options)) {
129
+ return;
130
+ }
131
+ const collectionTree = this.db.getCollection(name2);
132
+ if (collectionTree) {
133
+ await this.db.getCollection(name2).removeFromDb({ transaction });
134
+ collectionManager.db.removeAllListeners(`${collection2.name}.afterSync`);
135
+ this.db.removeAllListeners(`${collection2.name}.afterCreate`);
136
+ this.db.removeAllListeners(`${collection2.name}.afterUpdate`);
137
+ this.db.removeAllListeners(`${collection2.name}.afterBulkUpdate`);
138
+ this.db.removeAllListeners(`${collection2.name}.afterDestroy`);
139
+ this.db.removeAllListeners(`${collection2.name}.beforeSave`);
140
+ }
141
+ });
126
142
  });
127
143
  }
128
144
  });
129
- this.db.on("collections.afterDestroy", async (collection, { transaction }) => {
130
- const name = `main_${collection.get("name")}_path`;
131
- if (!condition(collection.options)) {
132
- return;
133
- }
134
- const collectionTree = this.db.getCollection(name);
135
- if (collectionTree) {
136
- await this.db.getCollection(name).removeFromDb({ transaction });
137
- }
138
- });
139
145
  }
140
146
  async defineTreePathCollection(name, options) {
141
147
  this.db.collection({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-collection-tree",
3
- "version": "1.9.0-beta.6",
3
+ "version": "1.9.0-beta.8",
4
4
  "displayName": "Collection: Tree",
5
5
  "displayName.zh-CN": "数据表:树",
6
6
  "description": "Provides tree collection template",
@@ -14,5 +14,5 @@
14
14
  "@nocobase/server": "1.x",
15
15
  "@nocobase/test": "1.x"
16
16
  },
17
- "gitHead": "ada5e359a91135cb9baf605c04c5c380f067a046"
17
+ "gitHead": "f3d4f3d1ba7adbf4d4c60e656c23da45565769c8"
18
18
  }