Skip to content

Commit

Permalink
clean up shadow blocks in insertion markers for expandable blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
riknoll committed Dec 10, 2024
1 parent 06fde1b commit 00e1e2f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pxtblocks/composableMutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,17 @@ export function initExpandableBlock(info: pxtc.BlocksInfo, b: Blockly.Block, def
// use domToBlockInternal so that we don't trigger a render while
// the block is still being initialized
newBlock = Blockly.Xml.domToBlockInternal(shadow, b.workspace);

// we don't know at this time whether the parent block is an insertion marker
// or not. doing this check lets us clean up the block in the case that it is,
// though we get an annoying flicker
setTimeout(() => {
if (newBlock.isInsertionMarker()) {
Blockly.Events.disable();
newBlock.dispose();
Blockly.Events.enable();
}
})
}
else {
newBlock = Blockly.Xml.domToBlock(shadow, b.workspace);
Expand Down

0 comments on commit 00e1e2f

Please sign in to comment.