From 2e8ff8d034f0dfe51349d24946c2fa1311b5259b Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Mon, 27 Apr 2026 08:52:16 +0300 Subject: [PATCH] Fix Global Search flashing "No results" when it's searching --- app/components/layout/GlobalSearch.tsx | 27 ++++++++++++++++++++------ locales/da/common.json | 1 + locales/de/common.json | 1 + locales/en/common.json | 1 + locales/es-ES/common.json | 1 + locales/es-US/common.json | 1 + locales/fr-CA/common.json | 1 + locales/fr-EU/common.json | 1 + locales/he/common.json | 1 + locales/it/common.json | 1 + locales/ja/common.json | 1 + locales/ko/common.json | 1 + locales/nl/common.json | 1 + locales/pl/common.json | 1 + locales/pt-BR/common.json | 1 + locales/ru/common.json | 1 + locales/zh/common.json | 1 + 17 files changed, 37 insertions(+), 6 deletions(-) diff --git a/app/components/layout/GlobalSearch.tsx b/app/components/layout/GlobalSearch.tsx index 81805f49e..496d3ab00 100644 --- a/app/components/layout/GlobalSearch.tsx +++ b/app/components/layout/GlobalSearch.tsx @@ -231,7 +231,10 @@ function GlobalSearchContent({ ); const hasQuery = query.length >= 3; + const fetchedQuery = fetcher.data?.query ?? null; const fetchedType = fetcher.data?.type ?? null; + const isCurrentFetch = + hasQuery && fetchedQuery === query && fetchedType === searchType; const results = hasQuery && fetchedType === searchType ? (fetcher.data?.results ?? []) : []; @@ -388,15 +391,27 @@ function GlobalSearchContent({ className={clsx(styles.listBox, "scrollbar")} aria-label={t("common:search")} onAction={handleSelect} - renderEmptyState={() => - hasQuery ? ( + renderEmptyState={() => { + if (!hasQuery) { + return ( +
+ {t("common:search.hint")} +
+ ); + } + if (!isCurrentFetch) { + return ( +
+ {t("common:search.searching")} +
+ ); + } + return (
{t("common:search.noResults")}
- ) : ( -
{t("common:search.hint")}
- ) - } + ); + }} > {results.map((result) => (