diff --git a/pxtblocks/composableMutations.ts b/pxtblocks/composableMutations.ts index d7a53d60e83..d3f0e52b8d7 100644 --- a/pxtblocks/composableMutations.ts +++ b/pxtblocks/composableMutations.ts @@ -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);