From d1911f0f9660700362182e79a7ffae06587778ed Mon Sep 17 00:00:00 2001 From: chfhtw Date: Wed, 15 Apr 2026 10:14:56 +0200 Subject: [PATCH] add shared cleanup function to prevent duplicate code --- public/js/components/Drop/Grid.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/public/js/components/Drop/Grid.js b/public/js/components/Drop/Grid.js index 528985e86..02fff8d71 100644 --- a/public/js/components/Drop/Grid.js +++ b/public/js/components/Drop/Grid.js @@ -487,13 +487,18 @@ export default { } } }, + _cleanupDragging() { + if (this.draggedItem) { + this.draggedItem = null; + } + }, dragCancel() { this.removeWidgetClones(); this.additionalRowComputed = false; this.mode = MODE_IDLE; this.tempPositionUpdates = null; - this.draggedOffset = [0,0], - this.draggedItem = null; + this.draggedOffset = [0,0]; + this._cleanupDragging(); }, dragEnd() { this.removeWidgetClones(); @@ -518,7 +523,7 @@ export default { if (updated.length) this.$emit('rearrangeItems', updated.filter(v => v)); - this.draggedItem = null; + this._cleanupDragging(); }, _updateCorrectedPositions(updated) { updated.forEach((item, index) => {