mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-14 21:12:53 +00:00
chore: safer plugins.delete
This commit is contained in:
parent
ec4a95c9ba
commit
1bb46dcf3b
@ -143,11 +143,10 @@ export class LowCodePluginManager implements ILowCodePluginManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async delete(pluginName: string): Promise<boolean> {
|
async delete(pluginName: string): Promise<boolean> {
|
||||||
const idx = this.plugins.findIndex((plugin) => plugin.name === pluginName);
|
const plugin = this.plugins.find(({ name }) => name === pluginName);
|
||||||
if (idx === -1) return false;
|
if (!plugin) return false;
|
||||||
const plugin = this.plugins[idx];
|
|
||||||
await plugin.destroy();
|
await plugin.destroy();
|
||||||
|
const idx = this.plugins.indexOf(plugin);
|
||||||
this.plugins.splice(idx, 1);
|
this.plugins.splice(idx, 1);
|
||||||
return this.pluginsMap.delete(pluginName);
|
return this.pluginsMap.delete(pluginName);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user