There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix(core): sign out jump to 404 (#4204)
Alex Yangb3d902e33f99
diff --git a/apps/core/src/components/affine/setting-modal/account-setting/index.tsx b/apps/core/src/components/affine/setting-modal/account-setting/index.tsxindex 55c5ffc16a..68d896c3e6 100644--- a/apps/core/src/components/affine/setting-modal/account-setting/index.tsx+++ b/apps/core/src/components/affine/setting-modal/account-setting/index.tsx@@ -15,6 +15,7 @@ import { type FC, Suspense, useCallback, useState } from 'react';import { authAtom } from '../../../../atoms';import { useCurrentUser } from '../../../../hooks/affine/use-current-user';+import { useNavigateHelper } from '../../../../hooks/use-navigate-helper';import { signOutCloud } from '../../../../utils/cloud-utils';import { Upload } from '../../../pure/file-upload';import * as style from './style.css';@@ -137,6 +138,7 @@ const StoragePanel = () => {export const AccountSetting: FC = () => {const t = useAFFiNEI18N();const user = useCurrentUser();+ const { jumpToIndex } = useNavigateHelper();const setAuthModal = useSetAtom(authAtom);const onChangeEmail = useCallback(() => {@@ -187,9 +189,14 @@ export const AccountSetting: FC = () => {name={t[`Sign out`]()}desc={t['com.affine.setting.sign.out.message']()}style={{ cursor: 'pointer' }}+ data-testid="sign-out-button"onClick={useCallback(() => {- signOutCloud().catch(console.error);- }, [])}+ signOutCloud()+ .then(() => {+ jumpToIndex();+ })+ .catch(console.error);+ }, [jumpToIndex])}><ArrowRightSmallIcon /></SettingRow>diff --git a/tests/affine-cloud/e2e/collaboration.spec.ts b/tests/affine-cloud/e2e/collaboration.spec.tsindex 7accc1e31b..64a1574a02 100644--- a/tests/affine-cloud/e2e/collaboration.spec.ts+++ b/tests/affine-cloud/e2e/collaboration.spec.ts@@ -10,6 +10,11 @@ import {getBlockSuiteEditorTitle,waitForEditorLoad,} from '@affine-test/kit/utils/page-logic';+import { clickUserInfoCard } from '@affine-test/kit/utils/setting';+import {+ clickSideBarAllPageButton,+ clickSideBarSettingButton,+} from '@affine-test/kit/utils/sidebar';import { createLocalWorkspace } from '@affine-test/kit/utils/workspace';import { expect } from '@playwright/test';@@ -100,4 +105,23 @@ test.describe('collaboration', () => {expect(await title.innerText()).toBe('TEST TITLE');}});++ test('exit successfully and re-login', async ({ page }) => {+ await page.reload();+ await clickSideBarAllPageButton(page);+ await page.waitForTimeout(200);+ const url = page.url();+ await createLocalWorkspace(+ {+ name: 'test',+ },+ page+ );+ await enableCloudWorkspace(page);+ await clickSideBarSettingButton(page);+ await clickUserInfoCard(page);+ await page.getByTestId('sign-out-button').click();+ await page.waitForTimeout(5000);+ expect(page.url()).toBe(url);+ });});diff --git a/tests/kit/utils/setting.ts b/tests/kit/utils/setting.tsindex bb464d3f3d..94d1c2e598 100644--- a/tests/kit/utils/setting.ts+++ b/tests/kit/utils/setting.ts@@ -33,3 +33,9 @@ export async function openWorkspaceSettingPanel() {await page.getByTestId('settings-sidebar').getByText(workspaceName).click();}++export async function clickUserInfoCard(page: Page) {+ await page.getByTestId('user-info-card').click({+ delay: 50,+ });+}