From 5143cc2b73f0d091647f8a9da1b176c07797c948 Mon Sep 17 00:00:00 2001 From: delmorallopez <124817272+delmorallopez@users.noreply.github.com> Date: Thu, 16 Apr 2026 18:31:38 +0100 Subject: [PATCH] fix error hashtag link --- front-end/views/hashtag.mjs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/front-end/views/hashtag.mjs b/front-end/views/hashtag.mjs index 7b7e996..a77a54b 100644 --- a/front-end/views/hashtag.mjs +++ b/front-end/views/hashtag.mjs @@ -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, @@ -28,6 +31,7 @@ function hashtagView(hashtag) { document .querySelector("[data-action='logout']") ?.addEventListener("click", handleLogout); + renderOne( state.isLoggedIn, getLoginContainer(), @@ -35,8 +39,8 @@ function hashtagView(hashtag) { createLogin ); document - .querySelector("[data-action='login']") - ?.addEventListener("click", handleLogin); + .querySelector('[data-form="login"]') + ?.addEventListener("submit", handleLogin); // also fix this 👀 renderOne( state.currentHashtag, @@ -44,6 +48,7 @@ function hashtagView(hashtag) { "heading-template", createHeading ); + renderEach( state.hashtagBlooms || [], getTimelineContainer(),