11import { clusterLayoutRoute } from '@/features/cluster/routes' ;
22import { InstanceLayout } from '@/features/instance/InstanceLayout' ;
33import { getInstanceInfoQueryOptions } from '@/features/cluster/queries/getInstanceInfoQuery' ;
4- import { currentUrlAfterHash } from '@/lib/urls/currentUrlAfterHash ' ;
4+ import { buildRedirectInSearch } from '@/lib/urls/buildRedirectInSearch ' ;
55import { dashboardLayout } from '@/router/dashboardRoute' ;
66import { createRoute , redirect } from '@tanstack/react-router' ;
77
@@ -22,7 +22,7 @@ export function createInstanceLayoutRoute(mode: 'local' | 'cluster' | 'instance'
2222 const auth = context . authentication [ params . clusterId ] ;
2323 if ( ! auth || ( ! auth . isLoading && ! auth . user ) ) {
2424 const to = `/${ params . organizationId } /${ params . clusterId } /sign-in` ;
25- throw redirect ( { to, search : currentUrlAfterHash ( ) !== '/' && { redirect : currentUrlAfterHash ( ) } } ) ;
25+ throw redirect ( { to, search : buildRedirectInSearch ( ) } ) ;
2626 }
2727 return await context . queryClient . ensureQueryData ( getInstanceInfoQueryOptions ( params ) ) ;
2828 } ,
@@ -36,7 +36,7 @@ export function createInstanceLayoutRoute(mode: 'local' | 'cluster' | 'instance'
3636 const auth = context . authentication [ params . instanceId ] ;
3737 if ( ! auth || ( ! auth . isLoading && ! auth . user ) ) {
3838 const to = `/${ params . organizationId } /${ params . clusterId } /instance/${ params . instanceId } /sign-in` ;
39- throw redirect ( { to, search : currentUrlAfterHash ( ) !== '/' && { redirect : currentUrlAfterHash ( ) } } ) ;
39+ throw redirect ( { to, search : buildRedirectInSearch ( ) } ) ;
4040 }
4141 return await context . queryClient . ensureQueryData ( getInstanceInfoQueryOptions ( params ) ) ;
4242 } ,
0 commit comments