debug: Add timestamps to console logs for better timing analysis - Add ISO timestamps to playlist selection and change detection logs - Add timestamp to loadPage function calls - Helps identify exact timing of playlist switching delays

This commit is contained in:
Geert Rademakes 2025-08-06 10:51:08 +02:00
parent 57c1047357
commit 586b3634b5
2 changed files with 3 additions and 2 deletions

View File

@ -154,7 +154,7 @@ export default function RekordboxReader() {
}, [currentPlaylist, playlists, navigate, xmlLoading]); }, [currentPlaylist, playlists, navigate, xmlLoading]);
const handlePlaylistSelect = (name: string) => { const handlePlaylistSelect = (name: string) => {
console.log('Playlist selected:', name); console.log(`[${new Date().toISOString()}] Playlist selected:`, name);
setSelectedSong(null); // Clear selected song when changing playlists setSelectedSong(null); // Clear selected song when changing playlists
if (name === "All Songs") { if (name === "All Songs") {
navigate("/"); navigate("/");

View File

@ -38,6 +38,7 @@ export const usePaginatedSongs = (options: UsePaginatedSongsOptions = {}) => {
// Load songs for a specific page // Load songs for a specific page
const loadPage = useCallback(async (page: number, search?: string, targetPlaylist?: string) => { const loadPage = useCallback(async (page: number, search?: string, targetPlaylist?: string) => {
console.log(`[${new Date().toISOString()}] loadPage called:`, { page, search, targetPlaylist });
if (loadingRef.current) return; if (loadingRef.current) return;
const searchToUse = search ?? currentSearchQueryRef.current; const searchToUse = search ?? currentSearchQueryRef.current;
@ -141,7 +142,7 @@ export const usePaginatedSongs = (options: UsePaginatedSongsOptions = {}) => {
// Handle playlist changes // Handle playlist changes
useEffect(() => { useEffect(() => {
if (previousPlaylistRef.current !== playlistName) { if (previousPlaylistRef.current !== playlistName) {
console.log('Playlist change detected:', previousPlaylistRef.current, '->', playlistName); console.log(`[${new Date().toISOString()}] Playlist change detected:`, previousPlaylistRef.current, '->', playlistName);
// Update refs // Update refs
currentPlaylistRef.current = playlistName; currentPlaylistRef.current = playlistName;