diff --git a/packages/nc-gui/composables/useViewGroupBy.ts b/packages/nc-gui/composables/useViewGroupBy.ts index 7aed1ea614..d70e7d67d7 100644 --- a/packages/nc-gui/composables/useViewGroupBy.ts +++ b/packages/nc-gui/composables/useViewGroupBy.ts @@ -3,7 +3,16 @@ import type { ColumnType, LinkToAnotherRecordType, LookupType, SelectOptionsType import type { Ref } from 'vue' import { message } from 'ant-design-vue' import { extractSdkResponseErrorMsg } from '../utils' -import { GROUP_BY_VARS, ref, storeToRefs, useApi, useBase, useMetas, useViewColumnsOrThrow } from '#imports' +import { + GROUP_BY_VARS, + SharedViewPasswordInj, + ref, + storeToRefs, + useApi, + useBase, + useMetas, + useViewColumnsOrThrow, +} from '#imports' import type { Group, GroupNestedIn, Row } from '#imports' const excludedGroupingUidt = [UITypes.Attachment, UITypes.QrCode, UITypes.Barcode] @@ -25,6 +34,8 @@ export const useViewGroupBy = (view: Ref, where?: Computed const { getMeta } = useMetas() + const sharedViewPassword = inject(SharedViewPasswordInj, ref(null)) + const groupBy = computed<{ column: ColumnType; sort: string; order?: number }[]>(() => { const tempGroupBy: { column: ColumnType; sort: string; order?: number }[] = [] Object.values(gridViewCols.value).forEach((col) => { @@ -236,16 +247,24 @@ export const useViewGroupBy = (view: Ref, where?: Computed sort: `${groupby.sort === 'desc' ? '-' : ''}${groupby.column.title}`, column_name: groupby.column.title, } as any) - : await api.public.dataGroupBy(sharedView.value!.uuid!, { - offset: ((group.paginationData.page ?? 0) - 1) * (group.paginationData.pageSize ?? groupByGroupLimit.value), - limit: group.paginationData.pageSize ?? groupByGroupLimit.value, - ...params, - where: nestedWhere, - sort: `${groupby.sort === 'desc' ? '-' : ''}${groupby.column.title}`, - column_name: groupby.column.title, - sortsArr: sorts.value, - filtersArr: nestedFilters.value, - }) + : await api.public.dataGroupBy( + sharedView.value!.uuid!, + { + offset: ((group.paginationData.page ?? 0) - 1) * (group.paginationData.pageSize ?? groupByGroupLimit.value), + limit: group.paginationData.pageSize ?? groupByGroupLimit.value, + ...params, + where: nestedWhere, + sort: `${groupby.sort === 'desc' ? '-' : ''}${groupby.column.title}`, + column_name: groupby.column.title, + sortsArr: sorts.value, + filtersArr: nestedFilters.value, + }, + { + headers: { + 'xc-password': sharedViewPassword.value, + }, + }, + ) const tempList: Group[] = response.list.reduce((acc: Group[], curr: Record) => { const keyExists = acc.find( diff --git a/tests/playwright/pages/Dashboard/Grid/Group.ts b/tests/playwright/pages/Dashboard/Grid/Group.ts index fba9a740e0..e82f4d7118 100644 --- a/tests/playwright/pages/Dashboard/Grid/Group.ts +++ b/tests/playwright/pages/Dashboard/Grid/Group.ts @@ -75,6 +75,11 @@ export class GroupPageObject extends BasePage { }) { const gridWrapper = this.get({ indexMap }); await gridWrapper.scrollIntoViewIfNeeded(); + + await gridWrapper.locator('.nc-group-table').waitFor({ state: 'visible' }); + + await gridWrapper.locator(`.nc-group-table .nc-grid-row:nth-child(${rowIndex + 1})`).waitFor({ state: 'visible' }); + await gridWrapper .locator(`.nc-group-table .nc-grid-row:nth-child(${rowIndex + 1}) [data-title="${columnHeader}"]`) .scrollIntoViewIfNeeded();