fix: prevent no results flickering

This commit is contained in:
Henry
2025-10-02 22:02:42 +01:00
parent 962aba8ccf
commit e526ad3bda

View File

@@ -74,7 +74,7 @@ export default function CommandPallette({
? [] ? []
: ((searchResults ?? []) as SearchResult[]); : ((searchResults ?? []) as SearchResult[]);
const hasSearched = Boolean(debouncedQuery.trim().length > 0 && isFetched); const hasSearched = Boolean(debouncedQuery.trim().length > 0);
return ( return (
<Dialog <Dialog
@@ -176,9 +176,12 @@ export default function CommandPallette({
</ComboboxOptions> </ComboboxOptions>
)} )}
{hasSearched && !isLoading && results.length === 0 && ( {hasSearched &&
!isLoading &&
searchResults !== undefined &&
results.length === 0 && (
<div className="p-4 text-sm text-light-950 dark:text-dark-950"> <div className="p-4 text-sm text-light-950 dark:text-dark-950">
{t`No results found for "${query}".`} {t`No results found for "${debouncedQuery}".`}
</div> </div>
)} )}
</Combobox> </Combobox>