Browse Source

fix(nc-gui): incorrect load more kanban data logic

pull/5269/head
Wing-Kam Wong 2 years ago
parent
commit
1ac5e8dd20
  1. 13
      packages/nc-gui/composables/useKanbanViewStore.ts
  2. 21
      packages/nc-gui/composables/useSharedView.ts

13
packages/nc-gui/composables/useKanbanViewStore.ts

@ -154,7 +154,7 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState(
)
}
for (const data of groupData) {
for (const data of groupData ?? []) {
const key = data.key
formattedData.value.set(key, formatData(data.value.list))
countByStack.value.set(key, data.value.pageInfo.totalRows || 0)
@ -176,9 +176,16 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState(
...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }),
where,
})
: await fetchSharedViewData({ sortsArr: sorts.value, filtersArr: nestedFilters.value, offset: params.offset })
: await fetchSharedViewData({
...{ where: xWhere.value },
...params,
sortsArr: sorts.value,
filtersArr: nestedFilters.value,
offset: params.offset,
where,
})
formattedData.value.set(stackTitle, [...formattedData.value.get(stackTitle)!, ...formatData(response!.list)])
formattedData.value.set(stackTitle, [...formattedData.value.get(stackTitle)!, ...formatData(response!.list!)])
}
async function loadKanbanMeta() {

21
packages/nc-gui/composables/useSharedView.ts

@ -83,13 +83,14 @@ export function useSharedView() {
Object.keys(relatedMetas).forEach((key) => setMeta(relatedMetas[key]))
}
const fetchSharedViewData = async ({
sortsArr,
filtersArr,
offset,
}: {
const fetchSharedViewData = async (param: {
sortsArr: SortType[]
filtersArr: FilterType[]
fields?: any[]
sort?: any[]
where?: string
/** Query params for nested data */
nested?: any
offset?: number
}) => {
if (!sharedView.value)
@ -98,18 +99,18 @@ export function useSharedView() {
pageInfo: {},
}
if (!offset) {
if (!param.offset) {
const page = paginationData.value.page || 1
const pageSize = paginationData.value.pageSize || appInfoDefaultLimit
offset = (page - 1) * pageSize
param.offset = (page - 1) * pageSize
}
return await $api.public.dataList(
sharedView.value.uuid!,
{
offset,
filterArrJson: JSON.stringify(filtersArr ?? nestedFilters.value),
sortArrJson: JSON.stringify(sortsArr ?? sorts.value),
...param,
filterArrJson: JSON.stringify(param.filtersArr ?? nestedFilters.value),
sortArrJson: JSON.stringify(param.sortsArr ?? sorts.value),
} as any,
{
headers: {

Loading…
Cancel
Save