chore: don't resolve when returning from promise & improve list store module

This commit is contained in:
Dominik Pschenitschni 2021-10-09 16:34:57 +02:00
parent 3b940cb56c
commit a776e1d2f3
No known key found for this signature in database
GPG key ID: B257AC0149F43A77
16 changed files with 130 additions and 150 deletions

View file

@ -227,19 +227,19 @@ export default {
.finally(() => cancel())
},
loadNextTasksForBucket(ctx, {listId, ps = {}, bucketId}) {
async loadNextTasksForBucket(ctx, {listId, ps = {}, bucketId}) {
const bucketIndex = findIndexById(ctx.state.buckets, bucketId)
const isLoading = ctx.state.bucketLoading[bucketIndex] ?? false
if (isLoading) {
return Promise.resolve()
return
}
const page = (ctx.state.taskPagesPerBucket[bucketIndex] ?? 1) + 1
const alreadyLoaded = ctx.state.allTasksLoadedForBucket[bucketIndex] ?? false
if (alreadyLoaded) {
return Promise.resolve()
return
}
const cancel = setLoading(ctx, 'kanban')
@ -334,7 +334,7 @@ export default {
// restore original state
ctx.commit('setBucketByIndex', {bucketIndex, bucket: oldBucket})
return Promise.reject(e)
throw e
})
.finally(() => cancel())
},