-
-
Notifications
You must be signed in to change notification settings - Fork 4
Description
The initial featured and recent songs are fetched on the server for rendering the initial homepage (SSR). Upon clicking the button to load more recent songs, new songs are fetched and appended to the current list of loaded songs so the recent song list component can be rendered again.
However, fetchRecentSongs
is part of the RecentSongsContext
's useEffect
hook, causing it to run on component mount. It thus replaces the songs fetched in the server with the ones that should follow it after clicking the button, causing two rows of the most recent songs to not appear in the homepage's first load.
Clicking a category button to select it, and then unselecting it again, causes the songs to appear as they should, as they get fetched from the backend again.