Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/block-shareable-procedures/src/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ const procedureCallerUpdateShapeMixin = {
if (!this.getProcedureModel()) return;
const id = this.getProcedureModel().getId();
if (!this.getTargetWorkspace_().getProcedureMap().has(id)) {
this.dispose();
this.dispose(true);
return;
}
this.updateName_();
Expand Down
30 changes: 30 additions & 0 deletions plugins/block-shareable-procedures/test/procedure_blocks.mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,36 @@ suite('Procedures', function () {
);
},
);

test(
'when the procedure definition block is deleted, all of its ' +
'associated callers are deleted, but the other blocks remain',
function () {
const defBlock = createProcDefBlock(this.workspace);
const callBlock1 = createProcCallBlock(this.workspace);
const ifBlock1 = this.workspace.newBlock('controls_if');
const ifBlock2 = this.workspace.newBlock('controls_if');

ifBlock1.nextConnection.connect(callBlock1.previousConnection);
callBlock1.nextConnection.connect(ifBlock2.previousConnection);

defBlock.dispose(true);
globalThis.clock.runAll();

assert.isTrue(
callBlock1.disposed,
'Expected the first caller to be disposed',
);
assert.isFalse(
ifBlock1.disposed,
'Expected the first if block 1 to be not be disposed',
);
assert.isFalse(
ifBlock2.disposed,
'Expected the second if block 2 to be not be disposed',
);
},
);
});

suite('caller blocks creating new def blocks', function () {
Expand Down