diff --git a/src/lib/routes/helpers.ts b/src/lib/routes/helpers.ts index 33e7563a3c..07407a1a3b 100644 --- a/src/lib/routes/helpers.ts +++ b/src/lib/routes/helpers.ts @@ -46,11 +46,7 @@ export function isTab(current: string, route: string) { // our tab routes can be variously referenced by 3 different names // this helper deals with that weirdness // -prf - return ( - current === route || - current === `${route}Tab` || - current === `${route}Inner` - ) + return current.startsWith(route) } export enum TabState { diff --git a/src/view/shell/desktop/LeftNav.tsx b/src/view/shell/desktop/LeftNav.tsx index 38d4dffb0e..b8b1136180 100644 --- a/src/view/shell/desktop/LeftNav.tsx +++ b/src/view/shell/desktop/LeftNav.tsx @@ -295,12 +295,17 @@ function SwitcherMenuProfileLink() { } return getCurrentRoute(state) }) - let isCurrent = - currentRouteInfo.name === 'Profile' - ? isTab(currentRouteInfo.name, pathName) && + const isCurrent = useMemo(() => { + if (currentRouteInfo.name === 'Profile') { + return ( + isTab(currentRouteInfo.name, pathName) && (currentRouteInfo.params as CommonNavigatorParams['Profile']).name === currentAccount?.handle - : isTab(currentRouteInfo.name, pathName) + ) + } else { + return isTab(currentRouteInfo.name, pathName) + } + }, [currentAccount?.handle, currentRouteInfo, pathName]) const onProfilePress = useCallback( (e: React.MouseEvent) => { if (e.ctrlKey || e.metaKey || e.altKey) {