From 3df72fb99ff24fb9a551565b7568d96f8614ed6f Mon Sep 17 00:00:00 2001 From: romanhotsiy Date: Thu, 1 Jul 2021 12:34:49 +0300 Subject: [PATCH] fix: broken linkify fixes #1655 --- src/common-elements/linkify.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common-elements/linkify.tsx b/src/common-elements/linkify.tsx index 5fa31afc..0b059968 100644 --- a/src/common-elements/linkify.tsx +++ b/src/common-elements/linkify.tsx @@ -39,9 +39,9 @@ const isModifiedEvent = (event) => export function Link(props: { to: string; className?: string; children?: any }) { const store = React.useContext(StoreContext); const clickHandler = React.useCallback( - (event) => { + (event: React.MouseEvent) => { if (!store) return; - navigate(store.menu.history, event); + navigate(store.menu.history, event, props.to); }, [store], ); @@ -60,14 +60,14 @@ export function Link(props: { to: string; className?: string; children?: any }) ); } -function navigate(history: HistoryService, event) { +function navigate(history: HistoryService, event: React.MouseEvent, to: string) { if ( !event.defaultPrevented && // onClick prevented default event.button === 0 && // ignore everything but left clicks !isModifiedEvent(event) // ignore clicks with modifier keys ) { event.preventDefault(); - history.replace(this.props.to); + history.replace(to); } }