Skip to content

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

@Bentroen

Description

@Bentroen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions