Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recent songs section skips the first page on initial page load #12

Open
Bentroen opened this issue Nov 16, 2024 · 0 comments
Open

Recent songs section skips the first page on initial page load #12

Bentroen opened this issue Nov 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Bentroen
Copy link
Member

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.

@Bentroen Bentroen added the bug Something isn't working label Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant