File tree Expand file tree Collapse file tree
apps/sim/app/access-requests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ vi.mock('@/ee/access-requests/components/organization-access-requests', () => ({
1818} ) )
1919
2020import AccessRequestsPage from '@/app/access-requests/page'
21+ import { MyAccessRequests } from '@/ee/access-requests/components/my-access-requests'
2122
2223describe ( 'access request sign-in redirect' , ( ) => {
2324 beforeEach ( ( ) => {
@@ -124,4 +125,20 @@ describe('access request sign-in redirect', () => {
124125 expect ( redirect ) . not . toHaveBeenCalled ( )
125126 expect ( organizationContext ) . not . toHaveBeenCalled ( )
126127 } )
128+
129+ it ( 'renders the standalone requester when the optional organization navigation lookup fails' , async ( ) => {
130+ authMockFns . mockGetSession . mockResolvedValue ( { user : { id : 'viewer' } } )
131+ organizationContext . mockRejectedValue ( new Error ( 'Organization context unavailable' ) )
132+
133+ const page = await AccessRequestsPage ( {
134+ searchParams : Promise . resolve ( { organizationId : 'organization' , requestId : 'request' } ) ,
135+ } )
136+
137+ expect ( redirect ) . not . toHaveBeenCalled ( )
138+ expect ( page . props . children . type ) . toBe ( MyAccessRequests )
139+ expect ( page . props . children . props ) . toEqual ( {
140+ scope : { kind : 'organization' , organizationId : 'organization' } ,
141+ standalone : true ,
142+ } )
143+ } )
127144} )
Original file line number Diff line number Diff line change 11import { Suspense } from 'react'
22import { ChipLink } from '@sim/emcn'
3+ import { createLogger } from '@sim/logger'
34import type { Metadata } from 'next'
45import { redirect } from 'next/navigation'
56import { createSearchParamsCache , createSerializer } from 'nuqs/server'
@@ -28,6 +29,7 @@ interface AccessRequestsPageProps {
2829const entrySearchParams = createSearchParamsCache ( accessRequestEntrySearchParams )
2930const serializeEntrySearchParams = createSerializer ( accessRequestEntrySearchParams )
3031const serializeRequesterSearchParams = createSerializer ( accessRequestSearchParams )
32+ const logger = createLogger ( 'AccessRequestsPage' )
3133
3234/** Session-only entry so access requests remain reachable outside the organization Search rollout. */
3335export default async function AccessRequestsPage ( { searchParams } : AccessRequestsPageProps ) {
@@ -53,7 +55,13 @@ export default async function AccessRequestsPage({ searchParams }: AccessRequest
5355 }
5456
5557 if ( params . view !== 'admin' ) {
56- const context = await getOrganizationSurfaceContext ( params . organizationId , session . user . id )
58+ const context = await getOrganizationSurfaceContext (
59+ params . organizationId ,
60+ session . user . id
61+ ) . catch ( ( error ) => {
62+ logger . warn ( 'Unable to resolve organization navigation for access requests' , { error } )
63+ return null
64+ } )
5765 if ( context ?. searchAccess . memberScoped ) {
5866 redirect (
5967 serializeRequesterSearchParams ( organizationRoutes ( params . organizationId ) . accessRequests , {
You can’t perform that action at this time.
0 commit comments