@@ -21,6 +21,7 @@ import useLocalize from '@hooks/useLocalize';
21
21
import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
22
22
import useThemeStyles from '@hooks/useThemeStyles' ;
23
23
import { scrollToRight } from '@libs/InputUtils' ;
24
+ import backHistory from '@libs/Navigation/helpers/backHistory' ;
24
25
import type { SearchOption } from '@libs/OptionsListUtils' ;
25
26
import type { OptionData } from '@libs/ReportUtils' ;
26
27
import { getAutocompleteQueryWithComma , getQueryWithoutAutocompletedPart } from '@libs/SearchAutocompleteUtils' ;
@@ -219,7 +220,9 @@ function SearchRouter({onRouterClose, shouldHideInputCaret, isSearchRouterDispla
219
220
}
220
221
221
222
onRouterClose ( ) ;
222
- Navigation . navigate ( ROUTES . SEARCH_ROOT . getRoute ( { query : updatedQuery } ) ) ;
223
+ backHistory ( ) . then ( ( ) => {
224
+ Navigation . navigate ( ROUTES . SEARCH_ROOT . getRoute ( { query : updatedQuery } ) ) ;
225
+ } ) ;
223
226
224
227
setTextInputValue ( '' ) ;
225
228
setAutocompleteQueryValue ( '' ) ;
@@ -284,11 +287,13 @@ function SearchRouter({onRouterClose, shouldHideInputCaret, isSearchRouterDispla
284
287
}
285
288
} else {
286
289
onRouterClose ( ) ;
287
- if ( item ?. reportID ) {
288
- Navigation . navigateToReportWithPolicyCheck ( { reportID : item ?. reportID } ) ;
289
- } else if ( 'login' in item ) {
290
- navigateToAndOpenReport ( item . login ? [ item . login ] : [ ] , false ) ;
291
- }
290
+ backHistory ( ) . then ( ( ) => {
291
+ if ( item ?. reportID ) {
292
+ Navigation . navigateToReportWithPolicyCheck ( { reportID : item ?. reportID } ) ;
293
+ } else if ( 'login' in item ) {
294
+ navigateToAndOpenReport ( item . login ? [ item . login ] : [ ] , false ) ;
295
+ }
296
+ } ) ;
292
297
}
293
298
} ,
294
299
[ autocompleteSubstitutions , onRouterClose , onSearchQueryChange , submitSearch , textInputValue ] ,
0 commit comments