From 50c7f4a490575a4326a63ef32dbecacb97516c63 Mon Sep 17 00:00:00 2001 From: Jens Frost Date: Mon, 29 May 2023 12:35:04 +0200 Subject: [PATCH] Fixed sorting of tasks to be added in same order as in original card when copying cards. --- client/src/sagas/core/services/tasks.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/client/src/sagas/core/services/tasks.js b/client/src/sagas/core/services/tasks.js index cae0cd4..3129e93 100644 --- a/client/src/sagas/core/services/tasks.js +++ b/client/src/sagas/core/services/tasks.js @@ -7,10 +7,18 @@ import api from '../../../api'; import { createLocalId } from '../../../utils/local-id'; export function* createTask(cardId, data) { - const nextData = { - ...data, - position: yield select(selectors.selectNextTaskPosition, cardId), - }; + let nextData = {}; + if (data.position) { + nextData = { + ...data, + position: data.position, + }; + } else { + nextData = { + ...data, + position: yield select(selectors.selectNextTaskPosition, cardId), + }; + } const localId = yield call(createLocalId);