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(core): give page reference correct link (#6587)

forehaloab17a05df3dd
diff --git a/packages/frontend/core/src/modules/workbench/view/workbench-link.tsx b/packages/frontend/core/src/modules/workbench/view/workbench-link.tsx
index 5345671725..3cf9adaf29 100644
--- a/packages/frontend/core/src/modules/workbench/view/workbench-link.tsx
+++ b/packages/frontend/core/src/modules/workbench/view/workbench-link.tsx
@@ -8,7 +8,6 @@ import { Workbench } from '../entities/workbench';
export const WorkbenchLink = ({
to,
- children,
onClick,
...other
}: React.PropsWithChildren<
@@ -17,6 +16,9 @@ export const WorkbenchLink = ({
const workbench = useService(Workbench);
const { appSettings } = useAppSettingHelper();
const basename = useLiveData(workbench.basename$);
+ const link =
+ basename +
+ (typeof to === 'string' ? to : `${to.pathname}${to.search}${to.hash}`);
const handleClick = useCallback(
(event: React.MouseEvent<HTMLAnchorElement>) => {
event.preventDefault();
@@ -29,21 +31,16 @@ export const WorkbenchLink = ({
if (appSettings.enableMultiView && environment.isDesktop) {
workbench.open(to, { at: 'beside' });
} else if (!environment.isDesktop) {
- const href =
- typeof to === 'string'
- ? to
- : `${to.pathname}${to.search}${to.hash}`;
- popupWindow(basename + href);
+ popupWindow(link);
}
} else {
workbench.open(to);
}
},
- [appSettings.enableMultiView, basename, onClick, to, workbench]
- );
- return (
- <a {...other} href="#" onClick={handleClick}>
- {children}
- </a>
+ [appSettings.enableMultiView, link, onClick, to, workbench]
);
+
+ // eslint suspicious runtime error
+ // eslint-disable-next-line react/no-danger-with-children
+ return <a {...other} href={link} onClick={handleClick} />;
};