Skip to content

Commit

Permalink
fix: sort order in the same list for Kanban (#3651)
Browse files Browse the repository at this point in the history
* fixing kanban dnd by stooping the modification of the original array by spreading to change the array reference

* fix sort order in the same list

* minor change in condition
  • Loading branch information
rahulramesha authored Feb 13, 2024
1 parent 1bf0682 commit 8313998
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions web/components/issues/issue-layouts/kanban/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,13 @@ export const handleDragDrop = async (

let updateIssue: any = {};

const sourceColumnId = (source?.droppableId && source?.droppableId.split("__")) || null;
const destinationColumnId = (destination?.droppableId && destination?.droppableId.split("__")) || null;
const sourceDroppableId = source?.droppableId;
const destinationDroppableId = destination?.droppableId;

if (!sourceColumnId || !destinationColumnId) return;
const sourceColumnId = (sourceDroppableId && sourceDroppableId.split("__")) || null;
const destinationColumnId = (destinationDroppableId && destinationDroppableId.split("__")) || null;

if (!sourceColumnId || !destinationColumnId || !sourceDroppableId || !destinationDroppableId) return;

const sourceGroupByColumnId = sourceColumnId[0] || null;
const destinationGroupByColumnId = destinationColumnId[0] || null;
Expand Down Expand Up @@ -123,7 +126,11 @@ export const handleDragDrop = async (
// for both horizontal and vertical dnd
updateIssue = {
...updateIssue,
...handleSortOrder(destinationIssues, destination.index, issueMap),
...handleSortOrder(
sourceDroppableId === destinationDroppableId ? sourceIssues : destinationIssues,
destination.index,
issueMap
),
};

if (subGroupBy && sourceSubGroupByColumnId && destinationSubGroupByColumnId) {
Expand Down

0 comments on commit 8313998

Please sign in to comment.