diff --git a/src/vs/workbench/browser/dnd.ts b/src/vs/workbench/browser/dnd.ts index cbd49d96a023a..01d53df44436c 100644 --- a/src/vs/workbench/browser/dnd.ts +++ b/src/vs/workbench/browser/dnd.ts @@ -576,6 +576,15 @@ export class CompositeDragAndDropObserver extends Disposable { private constructor() { super(); this.transferData = LocalSelectionTransfer.getInstance(); + + this._register(this._onDragEnd.event(e => { + const id = e.dragAndDropData.getData().id; + const type = e.dragAndDropData.getData().type; + const data = this.readDragData(type); + if (data && data.getData().id === id) { + this.transferData.clearData(type === 'view' ? DraggedViewIdentifier.prototype : DraggedCompositeIdentifier.prototype); + } + })); } private readDragData(type: ViewType): CompositeDragAndDropData | undefined { if (this.transferData.hasData(type === 'view' ? DraggedViewIdentifier.prototype : DraggedCompositeIdentifier.prototype)) { @@ -658,12 +667,8 @@ export class CompositeDragAndDropObserver extends Disposable { })); disposableStore.add(new DragAndDropObserver(element, { onDragEnd: e => { - const { id, type } = draggedItemProvider(); - + const { type } = draggedItemProvider(); const data = this.readDragData(type); - if (data && data.getData().id === id) { - this.transferData.clearData(type === 'view' ? DraggedViewIdentifier.prototype : DraggedCompositeIdentifier.prototype); - } if (!data) { return;