fix: get correct new postion after dropping task in different list
was getting the current draggable list based on whatever task group the task was in, ignoring that that task group might be different (when the task was dragged to a new list)
This commit is contained in:
parent
2e9767f1a0
commit
7bba294897
@ -396,6 +396,7 @@ const ProjectBoard: React.FC<ProjectBoardProps> = ({ projectID, onCardLabelClick
|
||||
__typename: 'UpdateTaskLocationPayload',
|
||||
previousTaskGroupID,
|
||||
task: {
|
||||
...droppedTask,
|
||||
__typename: 'Task',
|
||||
name: droppedTask.name,
|
||||
id: droppedTask.id,
|
||||
|
@ -39,6 +39,7 @@ type Props = {
|
||||
taskID: string;
|
||||
taskGroupID: string;
|
||||
complete?: boolean;
|
||||
position?: string | number;
|
||||
onContextMenu?: ($target: React.RefObject<HTMLElement>, taskID: string, taskGroupID: string) => void;
|
||||
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
||||
description?: null | string;
|
||||
@ -76,6 +77,7 @@ const Card = React.forwardRef(
|
||||
dueDate,
|
||||
description,
|
||||
checklists,
|
||||
position,
|
||||
watched,
|
||||
members,
|
||||
labelVariant,
|
||||
@ -205,7 +207,7 @@ const Card = React.forwardRef(
|
||||
) : (
|
||||
<CardTitle>
|
||||
{complete && <CompleteIcon width={16} height={16} />}
|
||||
{title}
|
||||
{`${title}${position ? ' - ' + position : ''}`}
|
||||
</CardTitle>
|
||||
)}
|
||||
<ListCardBadges>
|
||||
|
@ -84,10 +84,14 @@ const SimpleLists: React.FC<SimpleProps> = ({
|
||||
throw { error: 'task group can not be found' };
|
||||
}
|
||||
} else {
|
||||
const targetGroup = taskGroups.findIndex(
|
||||
const curTaskGroup = taskGroups.findIndex(
|
||||
taskGroup => taskGroup.tasks.findIndex(task => task.id === draggableId) !== -1,
|
||||
);
|
||||
const droppedTask = taskGroups[targetGroup].tasks.find(task => task.id === draggableId);
|
||||
let targetTaskGroup = curTaskGroup;
|
||||
if (!isSameList) {
|
||||
targetTaskGroup = taskGroups.findIndex(taskGroup => taskGroup.id === destination.droppableId);
|
||||
}
|
||||
const droppedTask = taskGroups[curTaskGroup].tasks.find(task => task.id === draggableId);
|
||||
|
||||
if (droppedTask) {
|
||||
droppedDraggable = {
|
||||
@ -95,7 +99,7 @@ const SimpleLists: React.FC<SimpleProps> = ({
|
||||
position: droppedTask.position,
|
||||
};
|
||||
beforeDropDraggables = getSortedDraggables(
|
||||
taskGroups[targetGroup].tasks.map(task => {
|
||||
taskGroups[targetTaskGroup].tasks.map(task => {
|
||||
return { id: task.id, position: task.position };
|
||||
}),
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user