Skip to content

Commit d2f26b1

Browse files
committed
bugfix: make search component loading say 'section' instead of 'product' for non-ecommerce
1 parent 608798d commit d2f26b1

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

clients/search-component/src/utils/hooks/chat-context.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -783,16 +783,20 @@ function ChatProvider({ children }: { children: React.ReactNode }) {
783783
);
784784

785785
setLoadingText((prev) => {
786+
const contentType =
787+
props.type === "ecommerce" ? "product" : "section";
786788
const match = prev.match(
787-
/Verifying relevance for product (\d+) of \d+/,
789+
new RegExp(
790+
`Verifying relevance for ${contentType} (\\d+) of \\d+`,
791+
),
788792
);
789793
if (prev === "Determing relevance of the results...") {
790-
return "Searching for relevant products...";
791-
} else if (prev === "Searching for relevant products...") {
792-
return `Verifying relevance for product 1 of ${searchOverGroupsResp.results.length}...`;
794+
return `Searching for relevant ${contentType}s...`;
795+
} else if (prev === `Searching for relevant ${contentType}s...`) {
796+
return `Verifying relevance for ${contentType} 1 of ${searchOverGroupsResp.results.length}...`;
793797
} else if (match) {
794798
const currentNumber = parseInt(match[1], 10);
795-
return `Verifying relevance for product ${currentNumber + 1} of ${searchOverGroupsResp.results.length}...`;
799+
return `Verifying relevance for ${contentType} ${currentNumber + 1} of ${searchOverGroupsResp.results.length}...`;
796800
}
797801
return prev;
798802
});

0 commit comments

Comments
 (0)