Skip to content

Commit b637177

Browse files
authored
chore(vue): Remove treatPendingAsSignedOut from useSession (#6459)
1 parent 8afe342 commit b637177

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

.changeset/sixty-dogs-film.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/vue': patch
3+
---
4+
5+
Remove `treatPendingAsSignedOut` from `useSession` and always return pending session

packages/vue/src/composables/useSession.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import type { PendingSessionOptions, UseSessionReturn } from '@clerk/types';
1+
import type { UseSessionReturn } from '@clerk/types';
22
import { computed } from 'vue';
33

44
import type { ToComputedRefs } from '../utils';
55
import { toComputedRefs } from '../utils';
66
import { 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

Comments
 (0)