Skip to content

Commit 7219800

Browse files
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
1 parent eb79f66 commit 7219800

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

core/dragging/block_drag_strategy.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -384,19 +384,24 @@ export class BlockDragStrategy implements IDragStrategy {
384384
if (this.connectionCandidate) {
385385
// Applying connections also rerenders the relevant blocks.
386386
this.applyConnections(this.connectionCandidate);
387+
this.disposeStep();
387388
} else {
388-
this.block.queueRender();
389+
this.block.queueRender().then(() => this.disposeStep());
389390
}
391+
392+
if (!this.inGroup) {
393+
eventUtils.setGroup(false);
394+
}
395+
}
396+
397+
/** Disposes of any state at the end of the drag. */
398+
private disposeStep() {
390399
this.block.snapToGrid();
391400

392401
// Must dispose after connections are applied to not break the dynamic
393402
// connections plugin. See #7859
394403
this.connectionPreviewer!.dispose();
395404
this.workspace.setResizesEnabled(true);
396-
397-
if (!this.inGroup) {
398-
eventUtils.setGroup(false);
399-
}
400405
}
401406

402407
/** Connects the given candidate connections. */

0 commit comments

Comments
 (0)