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