Browse Source

fix(nc-gui): include offset in fetchSharedViewData

pull/4848/head
Wing-Kam Wong 2 years ago
parent
commit
8b84a76bcb
  1. 3
      packages/nc-gui/composables/useKanbanViewStore.ts
  2. 19
      packages/nc-gui/composables/useSharedView.ts

3
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)])
}

19
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,

Loading…
Cancel
Save