1
1
import type { ProtectProps } from '@clerk/clerk-react' ;
2
+ import type { PendingSessionOptions } from '@clerk/types' ;
2
3
import React from 'react' ;
3
4
4
5
import { auth } from './auth' ;
5
6
6
- export async function SignedIn ( props : React . PropsWithChildren ) : Promise < React . JSX . Element | null > {
7
+ export async function SignedIn (
8
+ props : React . PropsWithChildren < PendingSessionOptions > ,
9
+ ) : Promise < React . JSX . Element | null > {
7
10
const { children } = props ;
8
- const { userId } = await auth ( ) ;
11
+ const { userId } = await auth ( { treatPendingAsSignedOut : props . treatPendingAsSignedOut } ) ;
9
12
return userId ? < > { children } </ > : null ;
10
13
}
11
14
12
- export async function SignedOut ( props : React . PropsWithChildren ) : Promise < React . JSX . Element | null > {
15
+ export async function SignedOut (
16
+ props : React . PropsWithChildren < PendingSessionOptions > ,
17
+ ) : Promise < React . JSX . Element | null > {
13
18
const { children } = props ;
14
- const { userId } = await auth ( ) ;
19
+ const { userId } = await auth ( { treatPendingAsSignedOut : props . treatPendingAsSignedOut } ) ;
15
20
return userId ? null : < > { children } </ > ;
16
21
}
17
22
@@ -29,7 +34,7 @@ export async function SignedOut(props: React.PropsWithChildren): Promise<React.J
29
34
*/
30
35
export async function Protect ( props : ProtectProps ) : Promise < React . JSX . Element | null > {
31
36
const { children, fallback, ...restAuthorizedParams } = props ;
32
- const { has, userId } = await auth ( ) ;
37
+ const { has, userId } = await auth ( { treatPendingAsSignedOut : props . treatPendingAsSignedOut } ) ;
33
38
34
39
/**
35
40
* Fallback to UI provided by user or `null` if authorization checks failed
0 commit comments