The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Fixed dropping into empty group (#15066)
Lucas Bordeaub3ddc2ddfb7b
diff --git a/packages/twenty-front/src/modules/object-record/record-drag/shared/utils/processGroupDragOperation.ts b/packages/twenty-front/src/modules/object-record/record-drag/shared/utils/processGroupDragOperation.tsindex a525802ea7e..e22bc25e0d6 100644--- a/packages/twenty-front/src/modules/object-record/record-drag/shared/utils/processGroupDragOperation.ts+++ b/packages/twenty-front/src/modules/object-record/record-drag/shared/utils/processGroupDragOperation.ts@@ -49,17 +49,44 @@ export const processGroupDragOperation = ({recordIdsByGroupFamilyState(destinationGroupId),) as string[];- const recordsWithPosition = extractRecordPositions(- destinationRecordIds,- snapshot,- );-const draggedRecordId = result.draggableId;+const dragOperationType = getDragOperationType({draggedRecordId,selectedRecordIds,});+ const targetGroupIsEmpty = destinationRecordIds.length === 0;++ if (targetGroupIsEmpty) {+ if (dragOperationType === 'single') {+ onUpdateRecord(+ {+ recordId: draggedRecordId,+ position: 1,+ },+ recordGroup.value,+ );+ } else {+ for (const [index, selectedRecordId] of selectedRecordIds.entries()) {+ onUpdateRecord(+ {+ recordId: selectedRecordId,+ position: index + 1,+ },+ recordGroup.value,+ );+ }+ }++ return;+ }++ const recordsWithPosition = extractRecordPositions(+ destinationRecordIds,+ snapshot,+ );+const destinationIndex = result.destination.index;const isDroppedAfterList = destinationIndex >= recordsWithPosition.length;