1- import type { PendingSessionOptions , UseSessionReturn } from '@clerk/types' ;
1+ import type { UseSessionReturn } from '@clerk/types' ;
22import { computed } from 'vue' ;
33
44import type { ToComputedRefs } from '../utils' ;
55import { toComputedRefs } from '../utils' ;
66import { useClerkContext } from './useClerkContext' ;
77
8- type UseSession = ( options ?: PendingSessionOptions ) => ToComputedRefs < UseSessionReturn > ;
8+ type UseSession = ( ) => ToComputedRefs < UseSessionReturn > ;
99
1010/**
1111 * Returns the current [`Session`](https://clerk.com/docs/references/javascript/session) object which provides
@@ -32,23 +32,20 @@ type UseSession = (options?: PendingSessionOptions) => ToComputedRefs<UseSession
3232 * </div>
3333 * </template>
3434 */
35- export const useSession : UseSession = ( options = { } ) => {
36- const { sessionCtx, ... clerkContext } = useClerkContext ( ) ;
35+ export const useSession : UseSession = ( ) => {
36+ const { sessionCtx, clerk } = useClerkContext ( ) ;
3737
3838 const result = computed < UseSessionReturn > ( ( ) => {
3939 if ( sessionCtx . value === undefined ) {
4040 return { isLoaded : false , isSignedIn : undefined , session : undefined } ;
4141 }
4242
43- const pendingAsSignedOut =
44- sessionCtx . value ?. status === 'pending' &&
45- ( options . treatPendingAsSignedOut ?? clerkContext . treatPendingAsSignedOut ) ;
46- const isSignedOut = sessionCtx . value === null || pendingAsSignedOut ;
43+ const isSignedOut = sessionCtx . value === null ;
4744 if ( isSignedOut ) {
4845 return { isLoaded : true , isSignedIn : false , session : null } ;
4946 }
5047
51- return { isLoaded : true , isSignedIn : true , session : sessionCtx . value } ;
48+ return { isLoaded : true , isSignedIn : ! ! clerk . value ?. isSignedIn , session : sessionCtx . value } ;
5249 } ) ;
5350
5451 return toComputedRefs ( result ) ;
0 commit comments