Skip to content

Commit

Permalink
fix up extenision removal
Browse files Browse the repository at this point in the history
  • Loading branch information
RedMan13 committed Dec 31, 2023
1 parent e9f886a commit 7938311
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 8 additions & 1 deletion src/engine/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -918,8 +918,13 @@ class Blocks {
if (preserveStack) {
const parent = this._blocks[block.parent];
const next = this._blocks[block.next];
if (parent) parent.next = block.next;
const input = parent?.inputs
? [...Object.entries(parent.inputs)]
.find(ent => ent[1].block === blockId)?.[1]
: null;
if (parent && !input) parent.next = block.next;
if (next) next.parent = block.parent;
if (next && input) input.block = block.next;
}

// Delete inputs (including branches)
Expand All @@ -945,6 +950,8 @@ class Blocks {
if (next) {
this._scripts.push(next.id);
next.topLevel = true;
next.x = block.x;
next.y = block.y;
}
this._scripts.splice(i, 1);
}
Expand Down
7 changes: 3 additions & 4 deletions src/extension-support/extension-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,10 +513,9 @@ class ExtensionManager {

removeExtension(id) {
const serviceName = this._loadedExtensions.get(id);
const {provider} = dispatch._getServiceProvider(serviceName);
if (typeof provider.remove === 'function') {
dispatch.call(serviceName, 'dispose');
}
dispatch.call(serviceName, 'dispose');
delete dispatch.services[serviceName];
delete this.runtime[`ext_${id}`];

this._loadedExtensions.delete(id);
const workerId = +serviceName.split('.')[1];
Expand Down

0 comments on commit 7938311

Please sign in to comment.