fix: stop empty-state flicker while the search query debounces

This commit is contained in:
Philipinho
2026-08-25 00:02:43 +01:00
parent dc15c8efed
commit 01b36db348
@@ -107,6 +107,8 @@ export function SearchSpotlight({ spaceId }: SearchSpotlightProps) {
}, [aiSearchError, t]); }, [aiSearchError, t]);
const isLabelBrowse = (filters.labelIds?.length ?? 0) > 0; const isLabelBrowse = (filters.labelIds?.length ?? 0) > 0;
// while the debounce is pending the empty list is not a settled "no results"
const isQuerySettled = query === debouncedSearchQuery;
// Determine result type for rendering // Determine result type for rendering
const isAttachmentSearch = const isAttachmentSearch =
@@ -235,6 +237,7 @@ export function SearchSpotlight({ spaceId }: SearchSpotlightProps) {
{(query.length > 0 || isLabelBrowse) && {(query.length > 0 || isLabelBrowse) &&
!isFetching && !isFetching &&
isQuerySettled &&
resultItems.length === 0 && ( resultItems.length === 0 && (
<Spotlight.Empty>{t("No results found...")}</Spotlight.Empty> <Spotlight.Empty>{t("No results found...")}</Spotlight.Empty>
)} )}