From 3dad9e64c275d2808445a94bfdc6da44a6519665 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 17 Apr 2024 11:07:21 +0000 Subject: [PATCH] refactor: exclude page info in response if previous request missing page info --- packages/nc-gui/composables/useViewData.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui/composables/useViewData.ts b/packages/nc-gui/composables/useViewData.ts index fcfc90e8e9..ec47ce409b 100644 --- a/packages/nc-gui/composables/useViewData.ts +++ b/packages/nc-gui/composables/useViewData.ts @@ -68,6 +68,8 @@ export function useViewData( const formattedData = ref([]) + const excludePageInfo = ref(false) + const isPublic = inject(IsPublicInj, ref(false)) const { base, isSharedBase } = storeToRefs(useBase()) @@ -202,8 +204,11 @@ export function useViewData( ...(isUIAllowed('sortSync') ? {} : { sortArrJson: JSON.stringify(sorts.value) }), ...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }), where: where?.value, + ...(excludePageInfo.value ? {} : { excludeCount: 'true' }), } as any, - { cancelToken: controller.value.token }, + { + cancelToken: controller.value.token, + }, ) : await fetchSharedViewData({ sortsArr: sorts.value, filtersArr: nestedFilters.value, where: where?.value }) } catch (error) { @@ -216,6 +221,7 @@ export function useViewData( } formattedData.value = formatData(response.list) paginationData.value = response.pageInfo || paginationData.value || {} + excludePageInfo.value = !response.pageInfo isPaginationLoading.value = false // to cater the case like when querying with a non-zero offset