fix: prevent no results flickering
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user