Skip to content

Commit 42c8eb2

Browse files
committed
fix(drag-drop): gracefully handle missing record in initial group during drop
- Replace throw with console.warn and early return when record is not found - This prevents app crash during race conditions in concurrent drag operations - Issue #16585
1 parent 6360fb3 commit 42c8eb2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/twenty-front/src/modules/object-record/record-drag/hooks/useUpdateDroppedRecordOnBoard.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,14 @@ export const useUpdateDroppedRecordOnBoard = () => {
105105
recordIndexRecordIdsByGroupCallbackFamilyState(targetRecordGroupId),
106106
) as string[];
107107

108+
// Gracefully handle the case where record is not found in initial group
109+
// This can happen due to race conditions during concurrent drag operations
110+
// or when the record has already been moved by another operation
108111
if (indexOfDroppedRecordInInitialRecordGroup === -1) {
109-
throw new Error(
110-
`Cannot find record id in initial record group ids on drop, this should not happen, recordId: ${recordId}, initialRecordGroupId: ${initialRecordGroupId}`,
112+
console.warn(
113+
`Record not found in initial group during drop operation. This may be due to a concurrent update. recordId: ${recordId}, initialRecordGroupId: ${initialRecordGroupId}`,
111114
);
115+
return;
112116
}
113117

114118
const newInitialGroupRecordIds =

0 commit comments

Comments
 (0)