@@ -377,11 +377,11 @@ export function SearchOverlay({
377377 eventGroupId : askAIEventGroupId . current ,
378378 } )
379379 setSelectedIndex ( - 1 )
380+ setSearchLoading ( true )
380381 updateParams ( {
381382 'search-overlay-ask-ai' : 'true' ,
382383 'search-overlay-input' : selectedOption . term ,
383384 } )
384- setSearchLoading ( true )
385385 setAIQuery ( selectedOption . term )
386386 inputRef . current ?. focus ( )
387387 }
@@ -645,6 +645,7 @@ export function SearchOverlay({
645645 listElementsRef ,
646646 askAIState ,
647647 showSpinner ,
648+ searchLoading ,
648649 previousSuggestionsListHeight ,
649650 ) }
650651 </ ActionList >
@@ -673,6 +674,7 @@ export function SearchOverlay({
673674 listElementsRef ,
674675 askAIState ,
675676 showSpinner ,
677+ searchLoading ,
676678 previousSuggestionsListHeight ,
677679 ) }
678680 </ ActionList >
@@ -883,14 +885,16 @@ function renderSearchGroups(
883885 setAICouldNotAnswer : ( value : boolean ) => void
884886 } ,
885887 showSpinner : boolean ,
888+ searchLoading : boolean ,
886889 previousSuggestionsListHeight : number | string ,
887890) {
888891 const groups = [ ]
889892
890893 let isInAskAIState = askAIState ?. isAskAIState && ! askAIState . aiSearchError
891894 let isInAskAIStateButNoAnswer = isInAskAIState && askAIState . aiCouldNotAnswer
892895
893- // already showing spinner when streaming AI response, so don't want to show 2 here
896+ // This spinner is for both the AI search and the general search results.
897+ // We already show a spinner when streaming AI response, so don't want to show 2 here
894898 if ( showSpinner && ! isInAskAIState ) {
895899 groups . push (
896900 < Box
@@ -1005,7 +1009,19 @@ function renderSearchGroups(
10051009 < ActionList . GroupHeading as = "h3" tabIndex = { - 1 } >
10061010 { t ( 'search.overlay.general_suggestions_list_heading' ) }
10071011 </ ActionList . GroupHeading >
1008- { items }
1012+ { searchLoading && isInAskAIState ? (
1013+ < Box
1014+ role = "status"
1015+ className = { styles . loadingContainer }
1016+ sx = { {
1017+ height : `${ previousSuggestionsListHeight } px` ,
1018+ } }
1019+ >
1020+ < Spinner />
1021+ </ Box >
1022+ ) : (
1023+ items
1024+ ) }
10091025 </ ActionList . Group > ,
10101026 )
10111027
0 commit comments