From a1c4fbf93663dcc031e4fb61ced455b8eb936ea1 Mon Sep 17 00:00:00 2001 From: kolaente Date: Fri, 13 Sep 2024 22:56:41 +0200 Subject: [PATCH] fix(view): correctly get paginated task results (cherry picked from commit e4b541e6535885bf3e7b1b60f0f75f56aa43e3e4) --- frontend/src/stores/kanban.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/frontend/src/stores/kanban.ts b/frontend/src/stores/kanban.ts index 4b9bca38b..28453fcb6 100644 --- a/frontend/src/stores/kanban.ts +++ b/frontend/src/stores/kanban.ts @@ -266,6 +266,15 @@ export const useKanbanStore = defineStore('kanban', () => { } } + function getPaginatedTaskResult(result: IBucket[], bucketId: IBucket['id']): ITask[] { + const bucket = result.find(b => b.id === bucketId) + if (!bucket) { + return [] + } + + return bucket.tasks + } + async function loadNextTasksForBucket( projectId: IProject['id'], viewId: IProjectView['id'], @@ -297,7 +306,8 @@ export const useKanbanStore = defineStore('kanban', () => { const taskService = new TaskCollectionService() try { - const tasks = await taskService.getAll({projectId, viewId}, params, page) + const result = await taskService.getAll({projectId, viewId}, params, page) + const tasks = getPaginatedTaskResult(result as unknown as IBucket[], bucketId) addTasksToBucket(tasks, bucketId) setTasksLoadedForBucketPage({bucketId, page}) if (taskService.totalPages <= page) {