From 8a71f879504503f4aec1140fe653d93602c664df Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 4 Jan 2022 18:07:41 -0500 Subject: [PATCH] fix: procedure param edits breaking undo (#5845) --- core/mutator.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/core/mutator.js b/core/mutator.js index 5e4e9ace673..f8c95326c08 100644 --- a/core/mutator.js +++ b/core/mutator.js @@ -419,7 +419,10 @@ Mutator.prototype.updateWorkspace_ = function() { // When the mutator's workspace changes, update the source block. if (this.rootBlock_.workspace === this.workspace_) { - eventUtils.setGroup(true); + const existingGroup = eventUtils.getGroup(); + if (!existingGroup) { + eventUtils.setGroup(true); + } const block = /** @type {!BlockSvg} */ (this.block_); const oldExtraState = BlockChange.getExtraBlockState_(block); @@ -444,11 +447,12 @@ Mutator.prototype.updateWorkspace_ = function() { eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CHANGE))( block, 'mutation', null, oldExtraState, newExtraState)); // Ensure that any bump is part of this mutation's event group. - const group = eventUtils.getGroup(); + const mutationGroup = eventUtils.getGroup(); setTimeout(function() { - eventUtils.setGroup(group); + const oldGroup = eventUtils.getGroup(); + eventUtils.setGroup(mutationGroup); block.bumpNeighbours(); - eventUtils.setGroup(false); + eventUtils.setGroup(oldGroup); }, internalConstants.BUMP_DELAY); } @@ -457,7 +461,7 @@ Mutator.prototype.updateWorkspace_ = function() { if (!this.workspace_.isDragging()) { this.resizeBubble_(); } - eventUtils.setGroup(false); + eventUtils.setGroup(existingGroup); } };