1
- import type { PendingSessionOptions , UseSessionReturn } from '@clerk/types' ;
1
+ import type { UseSessionReturn } from '@clerk/types' ;
2
2
import { computed } from 'vue' ;
3
3
4
4
import type { ToComputedRefs } from '../utils' ;
5
5
import { toComputedRefs } from '../utils' ;
6
6
import { useClerkContext } from './useClerkContext' ;
7
7
8
- type UseSession = ( options ?: PendingSessionOptions ) => ToComputedRefs < UseSessionReturn > ;
8
+ type UseSession = ( ) => ToComputedRefs < UseSessionReturn > ;
9
9
10
10
/**
11
11
* Returns the current [`Session`](https://clerk.com/docs/references/javascript/session) object which provides
@@ -32,23 +32,20 @@ type UseSession = (options?: PendingSessionOptions) => ToComputedRefs<UseSession
32
32
* </div>
33
33
* </template>
34
34
*/
35
- export const useSession : UseSession = ( options = { } ) => {
36
- const { sessionCtx, ... clerkContext } = useClerkContext ( ) ;
35
+ export const useSession : UseSession = ( ) => {
36
+ const { sessionCtx, clerk } = useClerkContext ( ) ;
37
37
38
38
const result = computed < UseSessionReturn > ( ( ) => {
39
39
if ( sessionCtx . value === undefined ) {
40
40
return { isLoaded : false , isSignedIn : undefined , session : undefined } ;
41
41
}
42
42
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 ;
47
44
if ( isSignedOut ) {
48
45
return { isLoaded : true , isSignedIn : false , session : null } ;
49
46
}
50
47
51
- return { isLoaded : true , isSignedIn : true , session : sessionCtx . value } ;
48
+ return { isLoaded : true , isSignedIn : ! ! clerk . value ?. isSignedIn , session : sessionCtx . value } ;
52
49
} ) ;
53
50
54
51
return toComputedRefs ( result ) ;
0 commit comments