fix: loading tasks with infinite scroll in kanban buckets (#920)

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/920
Reviewed-by: dpschen <dpschen@noreply.kolaente.de>
Co-authored-by: konrad <k@knt.li>
Co-committed-by: konrad <k@knt.li>
This commit is contained in:
konrad 2021-10-31 13:37:18 +00:00
parent 5b406b0172
commit 7aede352f1

View file

@ -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})
}
},