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,11 +176,14 @@ export default function CommandPallette({
</ComboboxOptions> </ComboboxOptions>
)} )}
{hasSearched && !isLoading && results.length === 0 && ( {hasSearched &&
<div className="p-4 text-sm text-light-950 dark:text-dark-950"> !isLoading &&
{t`No results found for "${query}".`} searchResults !== undefined &&
</div> results.length === 0 && (
)} <div className="p-4 text-sm text-light-950 dark:text-dark-950">
{t`No results found for "${debouncedQuery}".`}
</div>
)}
</Combobox> </Combobox>
</DialogPanel> </DialogPanel>
</div> </div>