@@ -377,11 +377,11 @@ export function SearchOverlay({
377
377
eventGroupId : askAIEventGroupId . current ,
378
378
} )
379
379
setSelectedIndex ( - 1 )
380
+ setSearchLoading ( true )
380
381
updateParams ( {
381
382
'search-overlay-ask-ai' : 'true' ,
382
383
'search-overlay-input' : selectedOption . term ,
383
384
} )
384
- setSearchLoading ( true )
385
385
setAIQuery ( selectedOption . term )
386
386
inputRef . current ?. focus ( )
387
387
}
@@ -645,6 +645,7 @@ export function SearchOverlay({
645
645
listElementsRef ,
646
646
askAIState ,
647
647
showSpinner ,
648
+ searchLoading ,
648
649
previousSuggestionsListHeight ,
649
650
) }
650
651
</ ActionList >
@@ -673,6 +674,7 @@ export function SearchOverlay({
673
674
listElementsRef ,
674
675
askAIState ,
675
676
showSpinner ,
677
+ searchLoading ,
676
678
previousSuggestionsListHeight ,
677
679
) }
678
680
</ ActionList >
@@ -883,14 +885,16 @@ function renderSearchGroups(
883
885
setAICouldNotAnswer : ( value : boolean ) => void
884
886
} ,
885
887
showSpinner : boolean ,
888
+ searchLoading : boolean ,
886
889
previousSuggestionsListHeight : number | string ,
887
890
) {
888
891
const groups = [ ]
889
892
890
893
let isInAskAIState = askAIState ?. isAskAIState && ! askAIState . aiSearchError
891
894
let isInAskAIStateButNoAnswer = isInAskAIState && askAIState . aiCouldNotAnswer
892
895
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
894
898
if ( showSpinner && ! isInAskAIState ) {
895
899
groups . push (
896
900
< Box
@@ -1005,7 +1009,19 @@ function renderSearchGroups(
1005
1009
< ActionList . GroupHeading as = "h3" tabIndex = { - 1 } >
1006
1010
{ t ( 'search.overlay.general_suggestions_list_heading' ) }
1007
1011
</ 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
+ ) }
1009
1025
</ ActionList . Group > ,
1010
1026
)
1011
1027
0 commit comments