pstream is dead; long live pstream taciturnaxolotl.github.io/pstream-ng/
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

make router history a bit safer

Pas 9aa6e408 cb5b46d7

+12 -7
+12 -7
src/stores/history/index.ts
··· 19 19 registerRoute(route) { 20 20 set((s) => { 21 21 s.routes.push(route); 22 + if (s.routes.length > 50) { 23 + s.routes.shift(); 24 + } 22 25 }); 23 26 }, 24 27 })), ··· 40 43 const routes = useHistoryStore((s) => s.routes); 41 44 const location = useLocation(); 42 45 const lastNonPlayerLink = useMemo(() => { 43 - const reversedRoutes = [...routes]; 44 - reversedRoutes.reverse(); 45 - const route = reversedRoutes.find( 46 - (v) => 46 + for (let i = routes.length - 1; i >= 0; i -= 1) { 47 + const v = routes[i]; 48 + if ( 47 49 !v.path.startsWith("/media") && // cannot be a player link 48 50 location.pathname !== v.path && // cannot be current link 49 51 !v.path.startsWith("/s/") && // cannot be a quick search link 50 - !v.path.startsWith("/onboarding"), // cannot be an onboarding link 51 - ); 52 - return route?.path ?? "/"; 52 + !v.path.startsWith("/onboarding") // cannot be an onboarding link 53 + ) { 54 + return v.path; 55 + } 56 + } 57 + return "/"; 53 58 }, [routes, location]); 54 59 return lastNonPlayerLink; 55 60 }