Skip to content

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.

fix: open in chat does not work when the panel is not opened (#6703)

pengx17cc17d3287e1e
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