fix(views): correctly pass project id when loading more tasks in kanban views

This commit is contained in:
kolaente 2024-03-19 13:55:05 +01:00
parent cf9b2fa203
commit 7c30b00668
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 5 additions and 8 deletions

View File

@ -370,7 +370,7 @@ const params = ref<TaskFilterParams>({
const getTaskDraggableTaskComponentData = computed(() => (bucket: IBucket) => {
return {
ref: (el: HTMLElement) => setTaskContainerRef(bucket.id, el),
onScroll: (event: Event) => handleTaskContainerScroll(bucket.id, bucket.projectId, event.target as HTMLElement),
onScroll: (event: Event) => handleTaskContainerScroll(bucket.id, event.target as HTMLElement),
type: 'transition-group',
name: !drag.value ? 'move-card' : null,
class: [
@ -420,7 +420,7 @@ function setTaskContainerRef(id: IBucket['id'], el: HTMLElement) {
taskContainerRefs.value[id] = el
}
function handleTaskContainerScroll(id: IBucket['id'], projectId: IProject['id'], el: HTMLElement) {
function handleTaskContainerScroll(id: IBucket['id'], el: HTMLElement) {
if (!el) {
return
}

View File

@ -175,10 +175,7 @@ export const useKanbanStore = defineStore('kanban', () => {
buckets.value[bucketIndex] = newBucket
}
function addTasksToBucket({tasks, bucketId}: {
tasks: ITask[];
bucketId: IBucket['id'];
}) {
function addTasksToBucket(tasks: ITask[], bucketId: IBucket['id']) {
const bucketIndex = findIndexById(buckets.value, bucketId)
const oldBucket = buckets.value[bucketIndex]
const newBucket = {
@ -267,7 +264,7 @@ export const useKanbanStore = defineStore('kanban', () => {
const params: TaskFilterParams = JSON.parse(JSON.stringify(ps))
params.sort_by = ['kanban_position']
params.sort_by = ['position']
params.order_by = ['asc']
params.filter = `${params.filter === '' ? '' : params.filter + ' && '}bucket_id = ${bucketId}`
params.filter_timezone = authStore.settings.timezone
@ -276,7 +273,7 @@ export const useKanbanStore = defineStore('kanban', () => {
const taskService = new TaskCollectionService()
try {
const tasks = await taskService.getAll({projectId, viewId}, params, page)
addTasksToBucket({tasks, bucketId: bucketId})
addTasksToBucket(tasks, bucketId)
setTasksLoadedForBucketPage({bucketId, page})
if (taskService.totalPages <= page) {
setAllTasksLoadedForBucket(bucketId)