From dece3f7615844e1209c8e5a5440cf96257dadabe Mon Sep 17 00:00:00 2001 From: Tom Hirst Date: Mon, 4 Jul 2022 17:58:10 +0100 Subject: [PATCH] Fix edge case on previous --- client/components/Link.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/components/Link.tsx b/client/components/Link.tsx index 965a0652..5478a809 100644 --- a/client/components/Link.tsx +++ b/client/components/Link.tsx @@ -28,7 +28,10 @@ const Link: FunctionComponent = ({ const { asPath } = router; const pathTrimmed = asPath.replace("/", ""); const hrefTrimmed = href.toString().replace("/", ""); - const isCurrent = hrefTrimmed && pathTrimmed.includes(hrefTrimmed); + const isCurrent = + asPath === "/" + ? asPath === href + : hrefTrimmed && pathTrimmed.includes(hrefTrimmed); const classes = classNames(className, { [currentClassName]: isCurrent,