Skip to content

Commit

Permalink
fix: useEffect order
Browse files Browse the repository at this point in the history
  • Loading branch information
lovegaoshi committed Dec 11, 2023
1 parent c929fcb commit 886c7a4
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/components/playlist/usePlaylistRN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,19 @@ export default (playlist: NoxMedia.Playlist) => {
}
};

/**
* playlistShouldReRender is a global state that indicates playlist should be
* refreshed. right now its only called when the playlist is updated in updatePlaylist.
* this should in turn clear all searching, checking and filtering.
*/
useEffect(() => {
resetSelected();
setChecking(false);
// setSearching(false);
setRows(playlist.songList);
setCachedSongs(Array.from(noxCache.noxMediaCache.cache.keys()));
}, [playlist, playlistShouldReRender]);

useEffect(() => {
if (
playerSetting.autoRSSUpdate &&
Expand All @@ -145,19 +158,6 @@ export default (playlist: NoxMedia.Playlist) => {
}
}, [playlist]);

/**
* playlistShouldReRender is a global state that indicates playlist should be
* refreshed. right now its only called when the playlist is updated in updatePlaylist.
* this should in turn clear all searching, checking and filtering.
*/
useEffect(() => {
resetSelected();
setChecking(false);
setSearching(false);
setRows(playlist.songList);
setCachedSongs(Array.from(noxCache.noxMediaCache.cache.keys()));
}, [playlist, playlistShouldReRender]);

useEffect(() => handleSearch(debouncedSearchText), [debouncedSearchText]);

useEffect(() => {
Expand Down

0 comments on commit 886c7a4

Please sign in to comment.