Routing fixes

This commit is contained in:
Geert Rademakes 2025-04-25 10:01:45 +02:00
parent ab531462c2
commit 5c1cf64c4c

View File

@ -129,9 +129,9 @@ export default function RekordboxReader() {
const resizeRef = useRef<{ startX: number; startWidth: number } | null>(null);
// Get the current playlist from URL or default to "All Songs"
const currentPlaylist = location.pathname === "/"
? "All Songs"
: decodeURIComponent(location.pathname.slice(1));
const currentPlaylist = location.pathname.startsWith("/playlists/")
? decodeURIComponent(location.pathname.slice("/playlists/".length))
: "All Songs";
useEffect(() => {
// Only run this check after the initial data load
@ -154,7 +154,7 @@ export default function RekordboxReader() {
} else {
// Use encodeURIComponent to properly handle spaces and special characters
const encodedName = encodeURIComponent(name);
navigate(`/${encodedName}`);
navigate(`/playlists/${encodedName}`);
}
};