blockly-samples icon indicating copy to clipboard operation
blockly-samples copied to clipboard

Disposing of a procedure definition disposes caller *and* next blocks

Open BeksOmega opened this issue 1 year ago • 0 comments

Check for duplicates

  • [X] I have searched for similar issues before opening a new one.

Component

block-sharable-procedures

Description

When you dispose of a procedure definition, it disposes of the callers (this is correct). However, it also disposes of the callers next blocks, which is not correct.

Reproduction steps

  1. Create the following arrangement in the sharable procedures demo image

  2. Delete the procedure definition block

  3. Observe how only the top level if block remains. Instead the two if blocks should be connected in a stack.

Stack trace

No response

Screenshots

No response

To fix

  1. Pass true here.
  2. Repeat the reproduction steps and ensure only the procedure call block is deleted, not all of its children
  3. Add a unit test as part of this suite that tests to ensure the child blocks of the caller are not deleted.

The dispose function takes an optional parameter that controls whether to "heal" the stack of blocks when one is deleted. If true, only the one block will be deleted and the child blocks of it will be connected to the deleted block's parent, if possible. If false (or unset, as here) the block and its children will be deleted.

If you'd like to work on this issue and you're new to Blockly / blockly-samples, there are some guidelines here. Comment on this issue if you'd like to work on it so we can assign it to you.

BeksOmega avatar Feb 21 '24 21:02 BeksOmega