From 2773e1201e7d6d0e1c681a1d1628dc3a340d9fe1 Mon Sep 17 00:00:00 2001 From: Kjell Kind Date: Tue, 17 Nov 2026 17:12:26 +0100 Subject: [PATCH] fix: keep the search guild banner in step with the search box The banner and the result tabs were siblings keyed by the same query, so React never removed old banners and they stacked up. The banner now follows the search box, so removing or typing a hashtag hides or shows it right away. Co-Authored-By: Claude Opus 5.5 --- resources/js/pages/search/index.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/resources/js/pages/search/index.tsx b/resources/js/pages/search/index.tsx index 2cf3f1a8a..d1782d8b1 100644 --- a/resources/js/pages/search/index.tsx +++ b/resources/js/pages/search/index.tsx @@ -93,7 +93,7 @@ export default function Index({ query }: { query: string }) { - + {query !== '' && ( @@ -146,10 +146,13 @@ export default function Index({ query }: { query: string }) { Index.layout = AppLayout; -function HashtagGuild({ query }: { query: string }) { +/** + * Follows the search box rather than the last submitted search, so the banner comes and goes as the hashtag is typed. + */ +function HashtagGuild({ term }: { term: string }) { const { guilds } = usePage().props; - const handle = /^#\p{L}[\p{L}\p{M}\p{N}_]{0,59}$/u.test(query) - ? query.slice(1).toLowerCase() + const handle = /^#\p{L}[\p{L}\p{M}\p{N}_]{0,59}$/u.test(term) + ? term.slice(1).toLowerCase() : null; if (!guilds || !handle) {