1
0

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
No known key found for this signature in database
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) => { const getTaskDraggableTaskComponentData = computed(() => (bucket: IBucket) => {
return { return {
ref: (el: HTMLElement) => setTaskContainerRef(bucket.id, el), 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', type: 'transition-group',
name: !drag.value ? 'move-card' : null, name: !drag.value ? 'move-card' : null,
class: [ class: [
@ -420,7 +420,7 @@ function setTaskContainerRef(id: IBucket['id'], el: HTMLElement) {
taskContainerRefs.value[id] = el taskContainerRefs.value[id] = el
} }
function handleTaskContainerScroll(id: IBucket['id'], projectId: IProject['id'], el: HTMLElement) { function handleTaskContainerScroll(id: IBucket['id'], el: HTMLElement) {
if (!el) { if (!el) {
return return
} }

View File

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