Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions front-end/views/hashtag.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ import {createHeading} from "../components/heading.mjs";
function hashtagView(hashtag) {
destroy();

apiService.getBloomsByHashtag(hashtag);

if (state.currentHashtag !== hashtag) { // fetches only when the hashtag changes
state.updateState({ currentHashtag: hashtag });
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getBloomsByHashtag already updates state itself, so I wouldn't also update it here.

There's a risk that otherwise, if someone calls render after this updateState runs but before the blooms are fetched, then we'll end up showing the new hashtag as a title but the old blooms in the feed, which would be incorrect/confusing.

apiService.getBloomsByHashtag(hashtag);
}
renderOne(
state.isLoggedIn,
getLogoutContainer(),
Expand Down