From 15332c8fcefca5c0455e82b24007f6bf74008bee Mon Sep 17 00:00:00 2001 From: Jip Fr Date: Sat, 16 Dec 2023 14:46:46 +0100 Subject: [PATCH] Fix /s/ back to home Co-authored-by: mrjvs --- src/stores/history/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/stores/history/index.ts b/src/stores/history/index.ts index 572358cf..8a85f777 100644 --- a/src/stores/history/index.ts +++ b/src/stores/history/index.ts @@ -43,11 +43,17 @@ export function useHistoryListener() { export function useLastNonPlayerLink() { const routes = useHistoryStore((s) => s.routes); + const location = useLocation(); const lastNonPlayerLink = useMemo(() => { const reversedRoutes = [...routes]; reversedRoutes.reverse(); - const route = reversedRoutes.find((v) => !v.path.startsWith("/media")); + const route = reversedRoutes.find( + (v) => + !v.path.startsWith("/media") && // cannot be a player link + location.pathname !== v.path && // cannot be current link + !v.path.startsWith("/s/") // cannot be a quick search link + ); return route?.path ?? "/"; - }, [routes]); + }, [routes, location]); return lastNonPlayerLink; }