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
13 changes: 9 additions & 4 deletions front-end/views/hashtag.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ import {createHeading} from "../components/heading.mjs";

// Hashtag view: show all tweets containing this tag

function hashtagView(hashtag) {
async function hashtagView(hashtag) {
destroy();

apiService.getBloomsByHashtag(hashtag);
// prevent infinite loop
if (state.currentHashtag !== `#${hashtag}`) {
await apiService.getBloomsByHashtag(hashtag);
}

renderOne(
state.isLoggedIn,
Expand All @@ -28,22 +31,24 @@ function hashtagView(hashtag) {
document
.querySelector("[data-action='logout']")
?.addEventListener("click", handleLogout);

renderOne(
state.isLoggedIn,
getLoginContainer(),
"login-template",
createLogin
);
document
.querySelector("[data-action='login']")
?.addEventListener("click", handleLogin);
.querySelector('[data-form="login"]')
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.

This is an unrelated change - in the future, please try to keep changes in separate branches/PRs!

?.addEventListener("submit", handleLogin); // also fix this 👀

renderOne(
state.currentHashtag,
getHeadingContainer(),
"heading-template",
createHeading
);

renderEach(
state.hashtagBlooms || [],
getTimelineContainer(),
Expand Down