@@ -3,11 +3,16 @@ import { prisma } from "~/db.server";
33import { getUsersInvites } from "~/models/member.server" ;
44import { SelectBestEnvironmentPresenter } from "~/presenters/SelectBestEnvironmentPresenter.server" ;
55import { requireUser } from "~/services/session.server" ;
6- import { deeplinkSuffix , resolveDeeplinkPage } from "~/utils/deeplinkPages" ;
6+ import {
7+ deeplinkSuffix ,
8+ resolveDeeplinkPage ,
9+ resolveOrganizationDeeplinkPage ,
10+ } from "~/utils/deeplinkPages" ;
711import {
812 invitesPath ,
913 newOrganizationPath ,
1014 newProjectPath ,
15+ organizationRuntimeUpdatesPath ,
1116 v3EnvironmentPath ,
1217} from "~/utils/pathBuilder" ;
1318
@@ -16,7 +21,9 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
1621 const user = await requireUser ( request ) ;
1722
1823 const { pathname, search } = new URL ( request . url ) ;
19- const page = resolveDeeplinkPage ( deeplinkSuffix ( pathname ) ) ;
24+ const suffix = deeplinkSuffix ( pathname ) ;
25+ const page = resolveDeeplinkPage ( suffix ) ;
26+ const organizationPage = resolveOrganizationDeeplinkPage ( suffix ) ;
2027
2128 const invites = await getUsersInvites ( { email : user . email } ) ;
2229 if ( invites . length > 0 ) {
@@ -26,11 +33,14 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
2633 const presenter = new SelectBestEnvironmentPresenter ( ) ;
2734 try {
2835 const { project, organization, environment } = await presenter . call ( { user } ) ;
29- const environmentPath = v3EnvironmentPath ( organization , project , environment ) ;
36+ if ( organizationPage === "runtime-updates" ) {
37+ return redirect ( `${ organizationRuntimeUpdatesPath ( organization ) } ${ search } ` ) ;
38+ }
3039
31- const suffix = page ? `/${ page } ` : "" ;
40+ const environmentPath = v3EnvironmentPath ( organization , project , environment ) ;
41+ const pageSuffix = page ? `/${ page } ` : "" ;
3242
33- return redirect ( `${ environmentPath } ${ suffix } ${ search } ` ) ;
43+ return redirect ( `${ environmentPath } ${ pageSuffix } ${ search } ` ) ;
3444 } catch ( _e ) {
3545 const organization = await prisma . organization . findFirst ( {
3646 where : {
@@ -47,6 +57,10 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
4757 } ) ;
4858
4959 if ( organization ) {
60+ if ( organizationPage === "runtime-updates" ) {
61+ return redirect ( `${ organizationRuntimeUpdatesPath ( organization ) } ${ search } ` ) ;
62+ }
63+
5064 return redirect ( newProjectPath ( organization ) ) ;
5165 }
5266
0 commit comments