Browse Source

fix: kanban infinite load

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/5550/merge
mertmit 1 year ago
parent
commit
3446578a8a
  1. 9
      packages/nc-gui/components/smartsheet/Kanban.vue

9
packages/nc-gui/components/smartsheet/Kanban.vue

@ -21,6 +21,7 @@ import {
onBeforeUnmount,
provide,
useAttachment,
useDebounceFn,
useKanbanViewStoreOrThrow,
useUndoRedo,
} from '#imports'
@ -30,6 +31,8 @@ interface Attachment {
url: string
}
const INFINITY_SCROLL_THRESHOLD = 100
const meta = inject(MetaInj, ref())
const view = inject(ActiveViewInj, ref())
@ -275,14 +278,14 @@ async function onMove(event: any, stackKey: string) {
}
}
const kanbanListScrollHandler = async (e: any) => {
if (e.target.scrollTop + e.target.clientHeight >= e.target.scrollHeight) {
const kanbanListScrollHandler = useDebounceFn(async (e: any) => {
if (e.target.scrollTop + e.target.clientHeight + INFINITY_SCROLL_THRESHOLD >= e.target.scrollHeight) {
const stackTitle = e.target.getAttribute('data-stack-title')
const pageSize = appInfo.defaultLimit || 25
const page = Math.ceil(formattedData.value.get(stackTitle)!.length / pageSize)
await loadMoreKanbanData(stackTitle, { offset: page * pageSize })
}
}
})
const kanbanListRef = (kanbanListElement: HTMLElement) => {
if (kanbanListElement) {

Loading…
Cancel
Save