From cc17d3287e1e71f50a80ecbbf191a8e5c74ea8a6 Mon Sep 17 00:00:00 2001 From: pengx17 Date: Fri, 26 Apr 2024 03:50:40 +0000 Subject: [PATCH] fix: open in chat does not work when the panel is not opened (#6703) https://github.com/toeverything/AFFiNE/pull/6503 does not work with "open in chat". IMO resetting tab whenever opening right panel does not make too much sense. @zanwei fix AFF-951 --- .../multi-tab-sidebar/view/header-switcher.tsx | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/packages/frontend/core/src/modules/multi-tab-sidebar/view/header-switcher.tsx b/packages/frontend/core/src/modules/multi-tab-sidebar/view/header-switcher.tsx index 9026c6002d..c9b1ac30da 100644 --- a/packages/frontend/core/src/modules/multi-tab-sidebar/view/header-switcher.tsx +++ b/packages/frontend/core/src/modules/multi-tab-sidebar/view/header-switcher.tsx @@ -1,8 +1,5 @@ import { IconButton } from '@affine/component'; -import { useJournalInfoHelper } from '@affine/core/hooks/use-journal'; -import { DocService, useService, WorkspaceService } from '@toeverything/infra'; import { assignInlineVars } from '@vanilla-extract/dynamic'; -import { useEffect } from 'react'; import type { SidebarTab, SidebarTabName } from '../multi-tabs/sidebar-tab'; import * as styles from './header-switcher.css'; @@ -20,20 +17,8 @@ export const MultiTabSidebarHeaderSwitcher = ({ activeTabName, setActiveTabName, }: MultiTabSidebarHeaderSwitcherProps) => { - const workspace = useService(WorkspaceService).workspace; - const doc = useService(DocService).doc; - - const { isJournal } = useJournalInfoHelper(workspace.docCollection, doc.id); - const activeExtension = tabs.find(ext => ext.name === activeTabName); - // if journal is active, set selected to journal - useEffect(() => { - const journalExtension = tabs.find(ext => ext.name === 'journal'); - isJournal && journalExtension && setActiveTabName('journal'); - !isJournal && setActiveTabName('outline'); - }, [tabs, isJournal, setActiveTabName]); - const vars = assignInlineVars({ [styles.activeIdx]: String( tabs.findIndex(ext => ext.name === activeExtension?.name) ?? 0