From 7aede352f16687ff2746d1f905c3faab89926f1d Mon Sep 17 00:00:00 2001 From: konrad Date: Sun, 31 Oct 2021 13:37:18 +0000 Subject: [PATCH] fix: loading tasks with infinite scroll in kanban buckets (#920) Co-authored-by: kolaente Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/920 Reviewed-by: dpschen Co-authored-by: konrad Co-committed-by: konrad --- src/store/modules/kanban.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/store/modules/kanban.js b/src/store/modules/kanban.js index acd6824e..a5e93991 100644 --- a/src/store/modules/kanban.js +++ b/src/store/modules/kanban.js @@ -229,16 +229,14 @@ export default { }, async loadNextTasksForBucket(ctx, {listId, ps = {}, bucketId}) { - const bucketIndex = findIndexById(ctx.state.buckets, bucketId) - - const isLoading = ctx.state.bucketLoading[bucketIndex] ?? false + const isLoading = ctx.state.bucketLoading[bucketId] ?? false if (isLoading) { return } - const page = (ctx.state.taskPagesPerBucket[bucketIndex] ?? 1) + 1 + const page = (ctx.state.taskPagesPerBucket[bucketId] ?? 1) + 1 - const alreadyLoaded = ctx.state.allTasksLoadedForBucket[bucketIndex] ?? false + const alreadyLoaded = ctx.state.allTasksLoadedForBucket[bucketId] ?? false if (alreadyLoaded) { return } @@ -272,7 +270,6 @@ export default { const taskService = new TaskCollectionService() try { - const tasks = await taskService.getAll({listId: listId}, params, page) ctx.commit('addTasksToBucket', {tasks, bucketId: bucketId}) ctx.commit('setTasksLoadedForBucketPage', {bucketId, page}) @@ -282,7 +279,7 @@ export default { return tasks } finally { cancel() - ctx.commit('setBucketLoading', {bucketId: bucketId, loading: false}) + ctx.commit('setBucketLoading', {bucketId, loading: false}) } },