Skip to content

Commit 1bb46dc

Browse files
橙林JackLian
authored andcommitted
chore: safer plugins.delete
1 parent ec4a95c commit 1bb46dc

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

packages/designer/src/plugin/plugin-manager.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,10 @@ export class LowCodePluginManager implements ILowCodePluginManager {
143143
}
144144

145145
async delete(pluginName: string): Promise<boolean> {
146-
const idx = this.plugins.findIndex((plugin) => plugin.name === pluginName);
147-
if (idx === -1) return false;
148-
const plugin = this.plugins[idx];
146+
const plugin = this.plugins.find(({ name }) => name === pluginName);
147+
if (!plugin) return false;
149148
await plugin.destroy();
150-
149+
const idx = this.plugins.indexOf(plugin);
151150
this.plugins.splice(idx, 1);
152151
return this.pluginsMap.delete(pluginName);
153152
}

0 commit comments

Comments
 (0)