An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
fix: prevent displaying '0' during search loading state
Yoshiki Miura59b4d1c5368a
diff --git a/components/search-section.tsx b/components/search-section.tsxindex 22aa7323..77740cf3 100644--- a/components/search-section.tsx+++ b/components/search-section.tsx@@ -43,6 +43,12 @@ export function SearchSection({: ''const { open } = useArtifact()++ const totalResults =+ (searchResults?.results?.length || 0) ++ (searchResults?.videos?.length || 0) ++ (searchResults?.images?.length || 0)+const header = (<buttontype="button"@@ -52,11 +58,7 @@ export function SearchSection({><ToolArgsSectiontool="search"- number={- (searchResults?.results?.length || 0) +- (searchResults?.videos?.length || 0) +- (searchResults?.images?.length || 0)- }+ number={searchResults ? totalResults : undefined}>{`${query}${includeDomainsString}`}</ToolArgsSection></button>)