From 8b84a76bcb26884695d5bf8ca831f38d35f6cc07 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 16 Jan 2023 17:22:00 +0800 Subject: [PATCH] fix(nc-gui): include offset in fetchSharedViewData --- .../nc-gui/composables/useKanbanViewStore.ts | 3 +-- packages/nc-gui/composables/useSharedView.ts | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/nc-gui/composables/useKanbanViewStore.ts b/packages/nc-gui/composables/useKanbanViewStore.ts index 4beaf05004..dcd4110e6b 100644 --- a/packages/nc-gui/composables/useKanbanViewStore.ts +++ b/packages/nc-gui/composables/useKanbanViewStore.ts @@ -145,8 +145,7 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState( ...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }), where, }) - : // TODO: add range - await fetchSharedViewData({ sortsArr: sorts.value, filtersArr: nestedFilters.value }) + : await fetchSharedViewData({ sortsArr: sorts.value, filtersArr: nestedFilters.value, offset: params.offset }) formattedData.value.set(stackTitle, [...formattedData.value.get(stackTitle)!, ...formatData(response.list)]) } diff --git a/packages/nc-gui/composables/useSharedView.ts b/packages/nc-gui/composables/useSharedView.ts index 93477fadbc..c3129a95a0 100644 --- a/packages/nc-gui/composables/useSharedView.ts +++ b/packages/nc-gui/composables/useSharedView.ts @@ -93,16 +93,27 @@ export function useSharedView() { Object.keys(relatedMetas).forEach((key) => setMeta(relatedMetas[key])) } - const fetchSharedViewData = async ({ sortsArr, filtersArr }: { sortsArr: SortType[]; filtersArr: FilterType[] }) => { + const fetchSharedViewData = async ({ + sortsArr, + filtersArr, + offset, + }: { + sortsArr: SortType[] + filtersArr: FilterType[] + offset?: number + }) => { if (!sharedView.value) return - const page = paginationData.value.page || 1 - const pageSize = paginationData.value.pageSize || appInfoDefaultLimit + if (!offset) { + const page = paginationData.value.page || 1 + const pageSize = paginationData.value.pageSize || appInfoDefaultLimit + offset = (page - 1) * pageSize + } const { data } = await $api.public.dataList( sharedView.value.uuid!, { - offset: (page - 1) * pageSize, + offset, filterArrJson: JSON.stringify(filtersArr ?? nestedFilters.value), sortArrJson: JSON.stringify(sortsArr ?? sorts.value), } as any,