diff --git a/packages/nc-gui/components/smartsheet/grid/GroupBy.vue b/packages/nc-gui/components/smartsheet/grid/GroupBy.vue index 082e04939e..773f6ea715 100644 --- a/packages/nc-gui/components/smartsheet/grid/GroupBy.vue +++ b/packages/nc-gui/components/smartsheet/grid/GroupBy.vue @@ -30,6 +30,8 @@ const emits = defineEmits(['update:paginationData']) const vGroup = useVModel(props, 'group', emits) +const { isViewDataLoading, isPaginationLoading } = storeToRefs(useViewsStore()) + const reloadViewDataHook = inject(ReloadViewDataHookInj, createEventHook()) const _depth = props.depth ?? 0 @@ -85,13 +87,19 @@ reloadViewDataHook?.on(reloadViewDataHandler) watch( [() => vGroup.value.key], - (n, o) => { + async (n, o) => { if (n !== o) { + isViewDataLoading.value = true + isPaginationLoading.value = true + if (vGroup.value.nested) { - props.loadGroups({}, vGroup.value) + await props.loadGroups({}, vGroup.value) } else { - props.loadGroupData(vGroup.value, true) + await props.loadGroupData(vGroup.value, true) } + + isViewDataLoading.value = false + isPaginationLoading.value = false } }, { immediate: true }, diff --git a/packages/nc-gui/pages/index/[typeOrId]/[projectId]/index/index/index.vue b/packages/nc-gui/pages/index/[typeOrId]/[projectId]/index/index/index.vue index 10933e4238..ccb6d6a9ae 100644 --- a/packages/nc-gui/pages/index/[typeOrId]/[projectId]/index/index/index.vue +++ b/packages/nc-gui/pages/index/[typeOrId]/[projectId]/index/index/index.vue @@ -112,7 +112,7 @@ function openQuickImportDialog(type: QuickImportTypes, file: File) { } watch( - () => project.value.id, + () => project.value?.id, () => { if (project.value?.id && project.value.type === 'database') { const { addTab } = useTabs() diff --git a/packages/nc-gui/pages/index/[typeOrId]/view/[viewId].vue b/packages/nc-gui/pages/index/[typeOrId]/view/[viewId].vue index aa472daa96..c39c910cdb 100644 --- a/packages/nc-gui/pages/index/[typeOrId]/view/[viewId].vue +++ b/packages/nc-gui/pages/index/[typeOrId]/view/[viewId].vue @@ -10,7 +10,7 @@ definePageMeta({ const route = useRoute() -const { loadSharedView } = useSharedView() +const { loadSharedView, meta } = useSharedView() const { isViewDataLoading } = storeToRefs(useViewsStore()) const showPassword = ref(false) @@ -37,5 +37,5 @@ onMounted(async () => { - + diff --git a/packages/nc-gui/store/tables.ts b/packages/nc-gui/store/tables.ts index a844942a38..bfbf842bc8 100644 --- a/packages/nc-gui/store/tables.ts +++ b/packages/nc-gui/store/tables.ts @@ -63,14 +63,10 @@ export const useTablesStore = defineStore('tablesStore', () => { ) const loadProjectTables = async (projectId: string, force = false) => { - const projects = projectsStore.projects if (!force && projectTables.value.get(projectId)) { return } - const workspaceProject = projects.get(projectId) - if (!workspaceProject) throw new Error('Project not found') - const existingTables = projectTables.value.get(projectId) if (existingTables && !force) { return diff --git a/tests/playwright/pages/Dashboard/Grid/Column/LTAR/LinkRecord.ts b/tests/playwright/pages/Dashboard/Grid/Column/LTAR/LinkRecord.ts index 6ea0a20344..352b786063 100644 --- a/tests/playwright/pages/Dashboard/Grid/Column/LTAR/LinkRecord.ts +++ b/tests/playwright/pages/Dashboard/Grid/Column/LTAR/LinkRecord.ts @@ -24,7 +24,7 @@ export class LinkRecord extends BasePage { { const childList = linkRecord.getByTestId(`nc-excluded-list-item`); - expect.poll(() => linkRecord.getByTestId(`nc-excluded-list-item`).count()).toBe(cardTitle.length); + await expect.poll(() => linkRecord.getByTestId(`nc-excluded-list-item`).count()).toBe(cardTitle.length); for (let i = 0; i < cardTitle.length; i++) { await childList.nth(i).locator('.nc-display-value').scrollIntoViewIfNeeded(); await childList.nth(i).locator('.nc-display-value').waitFor({ state: 'visible' }); diff --git a/tests/playwright/pages/Dashboard/TreeView.ts b/tests/playwright/pages/Dashboard/TreeView.ts index 3fbffddb65..68430cc7fc 100644 --- a/tests/playwright/pages/Dashboard/TreeView.ts +++ b/tests/playwright/pages/Dashboard/TreeView.ts @@ -99,7 +99,15 @@ export class TreeViewPage extends BasePage { if (networkResponse === true) { await this.waitForResponse({ - uiAction: () => this.get().getByTestId(`nc-tbl-title-${title}`).click(), + uiAction: () => + this.get() + .getByTestId(`nc-tbl-title-${title}`) + .click({ + position: { + x: 10, + y: 10, + }, + }), httpMethodsToMatch: ['GET'], requestUrlPathToMatch: `/api/v1/db/data/noco/`, responseJsonMatcher: json => json.pageInfo, diff --git a/tests/playwright/pages/Dashboard/common/Cell/index.ts b/tests/playwright/pages/Dashboard/common/Cell/index.ts index f04090517b..8176d0d390 100644 --- a/tests/playwright/pages/Dashboard/common/Cell/index.ts +++ b/tests/playwright/pages/Dashboard/common/Cell/index.ts @@ -341,7 +341,7 @@ export class CellPageObject extends BasePage { await this.rootPage.waitForSelector('.nc-modal-child-list:visible'); // verify child list count & contents - expect.poll(() => this.rootPage.locator('.ant-card:visible').count()).toBe(count); + await expect.poll(() => this.rootPage.locator('.ant-card:visible').count()).toBe(count); // close child list await this.rootPage.locator('.nc-modal-child-list').locator('.nc-close-btn').last().click(); diff --git a/tests/playwright/pages/Dashboard/common/Topbar/Share.ts b/tests/playwright/pages/Dashboard/common/Topbar/Share.ts index edf354c006..143d7c7a9f 100644 --- a/tests/playwright/pages/Dashboard/common/Topbar/Share.ts +++ b/tests/playwright/pages/Dashboard/common/Topbar/Share.ts @@ -51,7 +51,16 @@ export class TopbarSharePage extends BasePage { } async clickShareBasePublicAccess() { - await this.get().locator(`[data-testid="nc-share-base-sub-modal"]`).locator('.ant-switch').nth(0).click(); + await this.get() + .locator(`[data-testid="nc-share-base-sub-modal"]`) + .locator('.ant-switch') + .nth(0) + .click({ + position: { + x: 4, + y: 4, + }, + }); } async isSharedBasePublicAccessEnabled() { @@ -63,14 +72,25 @@ export class TopbarSharePage extends BasePage { } async clickShareBaseEditorAccess() { - await this.get().locator(`[data-testid="nc-share-base-sub-modal"]`).locator('.ant-switch').nth(1).click(); + await this.rootPage.waitForTimeout(1000); + + const shareBaseSwitch = this.get().locator(`[data-testid="nc-share-base-sub-modal"]`).locator('.ant-switch'); + const count = await shareBaseSwitch.count(); + + await this.get() + .locator(`[data-testid="nc-share-base-sub-modal"]`) + .locator('.ant-switch') + .nth(count - 1) + .click({ + position: { x: 4, y: 4 }, + }); } async isSharedBaseEditorAccessEnabled() { return await this.get() .locator(`[data-testid="nc-share-base-sub-modal"]`) .locator('.ant-switch') - .nth(1) + .nth(0) .isChecked(); } diff --git a/tests/playwright/pages/Dashboard/common/Topbar/index.ts b/tests/playwright/pages/Dashboard/common/Topbar/index.ts index 6f2fa9c21c..eb4eda4cc0 100644 --- a/tests/playwright/pages/Dashboard/common/Topbar/index.ts +++ b/tests/playwright/pages/Dashboard/common/Topbar/index.ts @@ -54,12 +54,13 @@ export class TopbarPage extends BasePage { return await this.getClipboardText(); } - async getSharedBaseUrl({ role }: { role: string }) { + async getSharedBaseUrl({ role, enableSharedBase }: { role: string; enableSharedBase: boolean }) { await this.clickShare(); - if (!(await this.share.isSharedBasePublicAccessEnabled())) await this.share.clickShareBasePublicAccess(); - if (role === 'editor' && !(await this.share.isSharedBaseEditorAccessEnabled())) { + if (enableSharedBase) await this.share.clickShareBasePublicAccess(); + + if (role === 'editor' && enableSharedBase) { await this.share.clickShareBaseEditorAccess(); - } else if (role === 'viewer' && (await this.share.isSharedBaseEditorAccessEnabled())) { + } else if (role === 'viewer' && !enableSharedBase) { await this.share.clickShareBaseEditorAccess(); } await this.share.clickCopyLink(); diff --git a/tests/playwright/pages/SharedForm/index.ts b/tests/playwright/pages/SharedForm/index.ts index cb2ce79ca3..2f435427e9 100644 --- a/tests/playwright/pages/SharedForm/index.ts +++ b/tests/playwright/pages/SharedForm/index.ts @@ -58,7 +58,7 @@ export class SharedFormPage extends BasePage { { const childList = linkRecord.locator(`.ant-card`); - expect.poll(() => linkRecord.locator(`.ant-card`).count()).toBe(cardTitle.length); + await expect.poll(() => linkRecord.locator(`.ant-card`).count()).toBe(cardTitle.length); for (let i = 0; i < cardTitle.length; i++) { expect(await childList.nth(i).textContent()).toContain(cardTitle[i]); } diff --git a/tests/playwright/tests/db/features/baseShare.spec.ts b/tests/playwright/tests/db/features/baseShare.spec.ts index 8265a8d19c..713f168810 100644 --- a/tests/playwright/tests/db/features/baseShare.spec.ts +++ b/tests/playwright/tests/db/features/baseShare.spec.ts @@ -66,7 +66,7 @@ test.describe('Shared base', () => { let url = ''; // share button visible only if a table is opened await dashboard.treeView.openTable({ title: 'Country' }); - url = await dashboard.grid.topbar.getSharedBaseUrl({ role: 'editor' }); + url = await dashboard.grid.topbar.getSharedBaseUrl({ role: 'editor', enableSharedBase: true }); await dashboard.rootPage.waitForTimeout(2000); // access shared base link @@ -85,7 +85,7 @@ test.describe('Shared base', () => { // await dashboard.treeView.openProject({ title: context.project.title }); await dashboard.treeView.openTable({ title: 'Country' }); - url = await dashboard.grid.topbar.getSharedBaseUrl({ role: 'viewer' }); + url = await dashboard.grid.topbar.getSharedBaseUrl({ role: 'viewer', enableSharedBase: false }); await dashboard.rootPage.waitForTimeout(2000); // access shared base link