1
0

fix(views): fetch buckets through view

This commit is contained in:
kolaente
2024-03-15 22:49:37 +01:00
parent cb111df2b7
commit ca0550acea
3 changed files with 8 additions and 5 deletions

View File

@ -226,15 +226,15 @@ export const useKanbanStore = defineStore('kanban', () => {
allTasksLoadedForBucket.value[bucketId] = true
}
async function loadBucketsForProject({projectId, params}: { projectId: IProject['id'], params }) {
async function loadBucketsForProject(projectId: IProject['id'], viewId: IProjectView['id'], params) {
const cancel = setModuleLoading(setIsLoading)
// Clear everything to prevent having old buckets in the project if loading the buckets from this project takes a few moments
setBuckets([])
const bucketService = new BucketService()
const taskCollectionService = new TaskCollectionService()
try {
const newBuckets = await bucketService.getAll({projectId}, {
const newBuckets = await taskCollectionService.getAll({projectId, viewId}, {
...params,
per_page: TASKS_PER_BUCKET,
})
@ -311,7 +311,7 @@ export const useKanbanStore = defineStore('kanban', () => {
const response = await bucketService.delete(bucket)
removeBucket(bucket)
// We reload all buckets because tasks are being moved from the deleted bucket
loadBucketsForProject({projectId: bucket.projectId, params})
loadBucketsForProject(bucket.projectId, bucket.projectViewId, params)
return response
} finally {
cancel()