From 90149eaaf7ec116050f0de99432e691f761720da Mon Sep 17 00:00:00 2001 From: Emilianouz <135679131+Emilianouz@users.noreply.github.com> Date: Wed, 11 Feb 2026 11:02:53 +0000 Subject: [PATCH] Optimize hashtag fetching to update state only when the hashtag changes --- front-end/views/hashtag.mjs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/front-end/views/hashtag.mjs b/front-end/views/hashtag.mjs index 7b7e996..5e2088a 100644 --- a/front-end/views/hashtag.mjs +++ b/front-end/views/hashtag.mjs @@ -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 }); + apiService.getBloomsByHashtag(hashtag); + } renderOne( state.isLoggedIn, getLogoutContainer(),