From 51ffccbbb6e3774407b1f18c68a77fed2ddb21e4 Mon Sep 17 00:00:00 2001 From: pengx17 Date: Thu, 31 Oct 2024 08:23:51 +0000 Subject: [PATCH] fix(core): do not redirect to open-page for open-in-app card (#8646) --- .../app-sidebar/views/open-in-app-card/open-in-app-card.tsx | 6 ++---- packages/frontend/core/src/modules/desktop-api/index.ts | 2 +- packages/frontend/core/src/modules/navigation/index.ts | 2 +- packages/frontend/core/src/modules/userspace/index.ts | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/frontend/core/src/modules/app-sidebar/views/open-in-app-card/open-in-app-card.tsx b/packages/frontend/core/src/modules/app-sidebar/views/open-in-app-card/open-in-app-card.tsx index ba8011467d..254020fd25 100644 --- a/packages/frontend/core/src/modules/app-sidebar/views/open-in-app-card/open-in-app-card.tsx +++ b/packages/frontend/core/src/modules/app-sidebar/views/open-in-app-card/open-in-app-card.tsx @@ -1,5 +1,4 @@ import { Button, Checkbox } from '@affine/component'; -import { useNavigateHelper } from '@affine/core/components/hooks/use-navigate-helper'; import { OpenInAppService, OpenLinkMode, @@ -16,17 +15,16 @@ import * as styles from './open-in-app-card.css'; export const OpenInAppCard = ({ className }: { className?: string }) => { const openInAppService = useService(OpenInAppService); const show = useLiveData(openInAppService.showOpenInAppBanner$); - const navigateHelper = useNavigateHelper(); const t = useI18n(); const [remember, setRemember] = useState(false); const onOpen = useCallback(() => { - navigateHelper.jumpToOpenInApp(window.location.href, true); + openInAppService.showOpenInAppPage(); if (remember) { openInAppService.setOpenLinkMode(OpenLinkMode.OPEN_IN_DESKTOP_APP); } - }, [openInAppService, remember, navigateHelper]); + }, [openInAppService, remember]); const onDismiss = useCallback(() => { openInAppService.dismissBanner( diff --git a/packages/frontend/core/src/modules/desktop-api/index.ts b/packages/frontend/core/src/modules/desktop-api/index.ts index 10c314224b..92949e58a4 100644 --- a/packages/frontend/core/src/modules/desktop-api/index.ts +++ b/packages/frontend/core/src/modules/desktop-api/index.ts @@ -4,7 +4,7 @@ import { WorkspaceScope, } from '@toeverything/infra'; -import { WorkbenchService } from '../workbench'; +import { WorkbenchService } from '../workbench/services/workbench'; import { DesktopApi } from './entities/electron-api'; import { ElectronApiImpl } from './impl'; import { DesktopApiProvider } from './provider'; diff --git a/packages/frontend/core/src/modules/navigation/index.ts b/packages/frontend/core/src/modules/navigation/index.ts index 853e1e89f5..a6adcbef3f 100644 --- a/packages/frontend/core/src/modules/navigation/index.ts +++ b/packages/frontend/core/src/modules/navigation/index.ts @@ -8,7 +8,7 @@ export { NavigationButtons } from './view/navigation-buttons'; import { type Framework, WorkspaceScope } from '@toeverything/infra'; -import { WorkbenchService } from '../workbench'; +import { WorkbenchService } from '../workbench/services/workbench'; import { Navigator } from './entities/navigator'; import { NavigatorService } from './services/navigator'; diff --git a/packages/frontend/core/src/modules/userspace/index.ts b/packages/frontend/core/src/modules/userspace/index.ts index af29e8dc61..e7135007fa 100644 --- a/packages/frontend/core/src/modules/userspace/index.ts +++ b/packages/frontend/core/src/modules/userspace/index.ts @@ -3,7 +3,7 @@ export { UserspaceService as UserDBService } from './services/userspace'; import type { Framework } from '@toeverything/infra'; import { AuthService, WebSocketService } from '../cloud'; -import { DesktopApiService } from '../desktop-api'; +import { DesktopApiService } from '../desktop-api/service/desktop-api'; import { CurrentUserDB } from './entities/current-user-db'; import { UserDB } from './entities/user-db'; import { UserDBEngine } from './entities/user-db-engine';