diff --git a/apps/core/src/components/affine/create-workspace-modal/index.tsx b/apps/core/src/components/affine/create-workspace-modal/index.tsx index c2afe6aab3..37694dc7d6 100644 --- a/apps/core/src/components/affine/create-workspace-modal/index.tsx +++ b/apps/core/src/components/affine/create-workspace-modal/index.tsx @@ -269,7 +269,8 @@ export const CreateWorkspaceModal = ({ const result: LoadDBFileResult = await window.apis.dialog.loadDBFile(); if (result.workspaceId && !canceled) { setAddedId(result.workspaceId); - setStep('set-syncing-mode'); + const newWorkspaceId = await addLocalWorkspace(result.workspaceId); + onCreate(newWorkspaceId); } else if (result.error || result.canceled) { if (result.error) { toast(t[result.error]()); @@ -287,7 +288,7 @@ export const CreateWorkspaceModal = ({ return () => { canceled = true; }; - }, [mode, onClose, t]); + }, [addLocalWorkspace, mode, onClose, onCreate, t]); const onConfirmEnableCloudSyncing = useCallback( (enableCloudSyncing: boolean) => { @@ -332,19 +333,11 @@ export const CreateWorkspaceModal = ({ const onConfirmName = useCallback( (name: string) => { setWorkspaceName(name); - if (environment.isDesktop && runtimeConfig.enableSQLiteProvider) { - setStep('set-syncing-mode'); - } else { - // this will be the last step for web for now - // fix me later - createLocalWorkspace(name) - .then(id => { - onCreate(id); - }) - .catch(err => { - logger.error(err); - }); - } + // this will be the last step for web for now + // fix me later + createLocalWorkspace(name).then(id => { + onCreate(id); + }); }, [createLocalWorkspace, onCreate] ); diff --git a/tests/affine-desktop/e2e/basic.spec.ts b/tests/affine-desktop/e2e/basic.spec.ts index 31acf3a28a..65de02d5a7 100644 --- a/tests/affine-desktop/e2e/basic.spec.ts +++ b/tests/affine-desktop/e2e/basic.spec.ts @@ -161,9 +161,9 @@ test('delete workspace', async ({ page }) => { await page.getByTestId('create-workspace-create-button').click({ delay: 100, }); - await page.getByTestId('create-workspace-continue-button').click({ - delay: 100, - }); + // await page.getByTestId('create-workspace-continue-button').click({ + // delay: 100, + // }); await page.waitForTimeout(1000); await clickSideBarSettingButton(page); await page.getByTestId('current-workspace-label').click(); diff --git a/tests/affine-desktop/e2e/workspace.spec.ts b/tests/affine-desktop/e2e/workspace.spec.ts index ee0e472532..e406039dec 100644 --- a/tests/affine-desktop/e2e/workspace.spec.ts +++ b/tests/affine-desktop/e2e/workspace.spec.ts @@ -98,8 +98,8 @@ test.fixme('export then add', async ({ page, appInfo, workspace }) => { await page.getByTestId('add-workspace').click(); // should show "Added Successfully" dialog - await page.waitForSelector('text="Added Successfully"'); - await page.getByTestId('create-workspace-continue-button').click(); + // await page.waitForSelector('text="Added Successfully"'); + // await page.getByTestId('create-workspace-continue-button').click(); // sleep for a while to wait for the workspace to be added :D await page.waitForTimeout(2000); diff --git a/tests/kit/utils/workspace.ts b/tests/kit/utils/workspace.ts index eb77aaddbc..aafea8b05e 100644 --- a/tests/kit/utils/workspace.ts +++ b/tests/kit/utils/workspace.ts @@ -19,9 +19,9 @@ export async function createLocalWorkspace( // open create workspace modal await page.getByTestId('new-workspace').click(); - const isDesktop: boolean = await page.evaluate(() => { - return !!window.appInfo?.electron; - }, []); + // const isDesktop: boolean = await page.evaluate(() => { + // return !!window.appInfo?.electron; + // }, []); // input workspace name await page.getByPlaceholder('Set a Workspace name').click(); @@ -32,7 +32,7 @@ export async function createLocalWorkspace( delay: 500, }); - if (isDesktop) { - await page.getByTestId('create-workspace-continue-button').click(); - } + // if (isDesktop) { + // await page.getByTestId('create-workspace-continue-button').click(); + // } }