perf: Remove unnecessary delays in playlist switching and infinite scroll - Remove setTimeout delay in playlist change handler - Reduce infinite scroll trigger delay from 1000ms to 100ms - Improve responsiveness when switching playlists and scrolling - Fixes 1-second delay between URL change and actual loading
This commit is contained in:
parent
e8bb2a4326
commit
9268a4635f
@ -257,7 +257,7 @@ export const PaginatedSongList: React.FC<PaginatedSongListProps> = memo(({
|
|||||||
// Reset the flag after a short delay to prevent multiple triggers
|
// Reset the flag after a short delay to prevent multiple triggers
|
||||||
timeoutRef.current = setTimeout(() => {
|
timeoutRef.current = setTimeout(() => {
|
||||||
isTriggeringRef.current = false;
|
isTriggeringRef.current = false;
|
||||||
}, 1000);
|
}, 100);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -149,10 +149,8 @@ export const usePaginatedSongs = (options: UsePaginatedSongsOptions = {}) => {
|
|||||||
setCurrentPage(1);
|
setCurrentPage(1);
|
||||||
setSearchQuery(initialSearch);
|
setSearchQuery(initialSearch);
|
||||||
setError(null);
|
setError(null);
|
||||||
// Use setTimeout to avoid the dependency issue
|
// Load immediately without setTimeout
|
||||||
setTimeout(() => {
|
loadPage(1, initialSearch, playlistName);
|
||||||
loadPage(1, initialSearch, playlistName);
|
|
||||||
}, 0);
|
|
||||||
}
|
}
|
||||||
}, [playlistName, isInitialLoad, initialSearch, loadPage]);
|
}, [playlistName, isInitialLoad, initialSearch, loadPage]);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user