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(electron): should not send switchSplitView event when clicking on the active view (#7944)

pengx172f02f0da2b64
diff --git a/packages/frontend/core/src/modules/app-tabs-header/views/app-tabs-header.tsx b/packages/frontend/core/src/modules/app-tabs-header/views/app-tabs-header.tsx
index d69c30cf8c..78e0d52c42 100644
--- a/packages/frontend/core/src/modules/app-tabs-header/views/app-tabs-header.tsx
+++ b/packages/frontend/core/src/modules/app-tabs-header/views/app-tabs-header.tsx
@@ -133,6 +133,9 @@ const WorkbenchTab = ({
);
const onActivateView = useAsyncCallback(
async (viewIdx: number) => {
+ if (viewIdx === activeViewIndex && tabActive) {
+ return;
+ }
await tabsHeaderService.activateView?.(workbench.id, viewIdx);
if (tabActive) {
track.$.appTabsHeader.$.tabAction({
@@ -146,7 +149,7 @@ const WorkbenchTab = ({
});
}
},
- [tabActive, tabsHeaderService, workbench.id]
+ [activeViewIndex, tabActive, tabsHeaderService, workbench.id]
);
const handleAuxClick: MouseEventHandler = useCatchEventCallback(
async e => {