From 9b2e9fc17f6f9bb25387dd6e5884d48feff6da22 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Thu, 7 Oct 2021 12:52:42 +0200 Subject: [PATCH] fix: getTaskById function --- src/store/modules/kanban.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/store/modules/kanban.js b/src/store/modules/kanban.js index e10aeea47..3668ba0e5 100644 --- a/src/store/modules/kanban.js +++ b/src/store/modules/kanban.js @@ -200,13 +200,13 @@ export default { let taskIndex const bucketIndex = state.buckets.findIndex(({ tasks }) => { taskIndex = findIndexById(tasks, id) - return taskIndex !== undefined + return taskIndex !== -1 }) - + return { - bucketIndex: taskIndex || null, - taskIndex: taskIndex || null, - task: state.buckets?.[bucketIndex].tasks?.[taskIndex] || null, + bucketIndex: bucketIndex !== -1 ? bucketIndex : null, + taskIndex: taskIndex !== -1 ? taskIndex : null, + task: state.buckets[bucketIndex]?.tasks?.[taskIndex] || null, } } },