Compare commits

...
Author SHA1 Message Date
Sonarly Claude CodeandClaude Opus 4.6 d0fbd46a19 Fix crash when dragging board card with desynced group state
Replace thrown error with graceful handling when a record's ID is not
found in its initial record group's ID list during drag-and-drop. This
state desync can occur during multi-drag operations or rapid navigation.
Instead of crashing, the move now proceeds by skipping the removal step
(record wasn't in the list anyway) and still completing the drop.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-20 01:02:19 +00:00
@@ -96,27 +96,23 @@ export const useUpdateDroppedRecordOnBoard = () => {
recordIndexRecordIdsByGroupCallbackFamilyState(targetRecordGroupId),
);
if (positionOfDroppedRecordInInitialRecordIds === -1) {
throw new Error(
`Cannot find record id in initial record group ids on drop, this should not happen`,
);
}
if (positionOfDroppedRecordInInitialRecordIds !== -1) {
const newInitialGroupRecordIds =
currentRecordIdsInInitialRecordGroup.toSpliced(
positionOfDroppedRecordInInitialRecordIds,
1,
);
const newInitialGroupRecordIds =
currentRecordIdsInInitialRecordGroup.toSpliced(
positionOfDroppedRecordInInitialRecordIds,
1,
);
if (movingInsideSameRecordGroup) {
currentRecordIdsInTargetRecordGroup = newInitialGroupRecordIds;
} else {
set(
recordIndexRecordIdsByGroupCallbackFamilyState(
initialRecordGroupId,
),
newInitialGroupRecordIds,
);
if (movingInsideSameRecordGroup) {
currentRecordIdsInTargetRecordGroup = newInitialGroupRecordIds;
} else {
set(
recordIndexRecordIdsByGroupCallbackFamilyState(
initialRecordGroupId,
),
newInitialGroupRecordIds,
);
}
}
const targetGroupRecordsWithIds = extractRecordPositions(