From 72198001831a81a63d840faf8de267b7da92c0a8 Mon Sep 17 00:00:00 2001 From: "Mateus S. Pereira" <68961261+mateusslezinsky@users.noreply.github.com> Date: Wed, 4 Dec 2024 14:25:01 -0300 Subject: [PATCH] fix: workspace shifts when deleting a block (#8666) * fix: workspace shifts when deleting a block * fix: awaiting for block rerender * fix: create reusable method to prevent marking method as async --- core/dragging/block_drag_strategy.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/core/dragging/block_drag_strategy.ts b/core/dragging/block_drag_strategy.ts index c3be97da68..c9a1ea0abf 100644 --- a/core/dragging/block_drag_strategy.ts +++ b/core/dragging/block_drag_strategy.ts @@ -384,19 +384,24 @@ export class BlockDragStrategy implements IDragStrategy { if (this.connectionCandidate) { // Applying connections also rerenders the relevant blocks. this.applyConnections(this.connectionCandidate); + this.disposeStep(); } else { - this.block.queueRender(); + this.block.queueRender().then(() => this.disposeStep()); } + + if (!this.inGroup) { + eventUtils.setGroup(false); + } + } + + /** Disposes of any state at the end of the drag. */ + private disposeStep() { this.block.snapToGrid(); // Must dispose after connections are applied to not break the dynamic // connections plugin. See #7859 this.connectionPreviewer!.dispose(); this.workspace.setResizesEnabled(true); - - if (!this.inGroup) { - eventUtils.setGroup(false); - } } /** Connects the given candidate connections. */