diff --git a/frontend/src/AppRoutes/Private.tsx b/frontend/src/AppRoutes/Private.tsx index c689786fcc..35c4f11e20 100644 --- a/frontend/src/AppRoutes/Private.tsx +++ b/frontend/src/AppRoutes/Private.tsx @@ -18,6 +18,7 @@ import routes, { LIST_LICENSES, oldNewRoutesMapping, oldRoutes, + ROUTES_NOT_TO_BE_OVERRIDEN, SUPPORT_ROUTE, } from './routes'; @@ -90,7 +91,12 @@ function PrivateRoute({ children }: PrivateRouteProps): JSX.Element { )?.value; const isFirstUser = checkFirstTimeUser(); - if (isFirstUser && !isOnboardingComplete) { + if ( + isFirstUser && + !isOnboardingComplete && + // if the current route is allowed to be overriden by org onboarding then only do the same + !ROUTES_NOT_TO_BE_OVERRIDEN.includes(pathname) + ) { history.push(ROUTES.ONBOARDING); } } diff --git a/frontend/src/AppRoutes/routes.ts b/frontend/src/AppRoutes/routes.ts index f1490ec74e..1291e32cb1 100644 --- a/frontend/src/AppRoutes/routes.ts +++ b/frontend/src/AppRoutes/routes.ts @@ -443,6 +443,11 @@ export const oldNewRoutesMapping: Record = { '/settings/access-tokens': '/settings/api-keys', }; +export const ROUTES_NOT_TO_BE_OVERRIDEN: string[] = [ + ROUTES.WORKSPACE_LOCKED, + ROUTES.WORKSPACE_SUSPENDED, +]; + export interface AppRoutes { component: RouteProps['component']; path: RouteProps['path']; diff --git a/frontend/src/providers/App/App.tsx b/frontend/src/providers/App/App.tsx index 36a9817e68..0451ffbb58 100644 --- a/frontend/src/providers/App/App.tsx +++ b/frontend/src/providers/App/App.tsx @@ -144,7 +144,7 @@ export function AppProvider({ children }: PropsWithChildren): JSX.Element { error: orgPreferencesFetchError, } = useQuery({ queryFn: () => getAllOrgPreferences(), - queryKey: ['getOrgPreferences'], + queryKey: ['getOrgPreferences', 'app-context'], enabled: !!isLoggedIn && !!user.email && user.role === USER_ROLES.ADMIN, });