@@ -3,7 +3,7 @@ import type {LocationDescriptor, LocationDescriptorObject} from 'history';
33
44import { openModal } from 'sentry/actionCreators/modal' ;
55import { ContextPickerModalContainer as ContextPickerModal } from 'sentry/components/contextPickerModal' ;
6- import type { InjectedRouter } from 'sentry/types/legacyReactRouter ' ;
6+ import { useNavigate } from 'sentry/utils/useNavigate ' ;
77
88type Project = {
99 id : string ;
@@ -22,17 +22,16 @@ type Props = {
2222 */
2323 noProjectRedirectPath : LocationDescriptor ;
2424 projects : Project [ ] ;
25- router : InjectedRouter ;
2625 allowAllProjectsSelection ?: boolean ;
2726} ;
2827
2928export function PickProjectToContinue ( {
3029 noProjectRedirectPath,
3130 nextPath,
32- router,
3331 projects,
3432 allowAllProjectsSelection = false ,
3533} : Props ) {
34+ const navigate = useNavigate ( ) ;
3635 const nextPathQuery = nextPath . query ;
3736 let navigating = false ;
3837 let path = `${ nextPath . pathname } ?project=` ;
@@ -49,7 +48,7 @@ export function PickProjectToContinue({
4948
5049 // if the project in URL is missing, but this release belongs to only one project, redirect there
5150 if ( projects . length === 1 ) {
52- router . replace ( path + projects [ 0 ] ! . id ) ;
51+ navigate ( path + projects [ 0 ] ! . id , { replace : true } ) ;
5352 return null ;
5453 }
5554
@@ -62,7 +61,7 @@ export function PickProjectToContinue({
6261 nextPath = { `${ path } :project` }
6362 onFinish = { to => {
6463 navigating = true ;
65- router . replace ( to ) ;
64+ navigate ( to , { replace : true } ) ;
6665 modalProps . closeModal ( ) ;
6766 } }
6867 projectSlugs = { projects . map ( p => p . slug ) }
@@ -74,7 +73,7 @@ export function PickProjectToContinue({
7473 // we want this to be executed only if the user didn't select any project
7574 // (closed modal either via button, Esc, clicking outside, ...)
7675 if ( ! navigating ) {
77- router . push ( noProjectRedirectPath ) ;
76+ navigate ( noProjectRedirectPath ) ;
7877 }
7978 } ,
8079 }
0 commit comments