mirror of
https://github.com/docmost/docmost.git
synced 2026-08-25 15:57:11 +08:00
fix: stop empty-state flicker while the search query debounces
This commit is contained in:
@@ -107,6 +107,8 @@ export function SearchSpotlight({ spaceId }: SearchSpotlightProps) {
|
||||
}, [aiSearchError, t]);
|
||||
|
||||
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
|
||||
const isAttachmentSearch =
|
||||
@@ -235,6 +237,7 @@ export function SearchSpotlight({ spaceId }: SearchSpotlightProps) {
|
||||
|
||||
{(query.length > 0 || isLabelBrowse) &&
|
||||
!isFetching &&
|
||||
isQuerySettled &&
|
||||
resultItems.length === 0 && (
|
||||
<Spotlight.Empty>{t("No results found...")}</Spotlight.Empty>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user