mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-29 15:46:07 +00:00
Fix /s/ back to home
Co-authored-by: mrjvs <mistrjvs@gmail.com>
This commit is contained in:
parent
b91f0e4b3d
commit
15332c8fce
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue