Skip to content

Commit

Permalink
fix(vue): Make sure Clerk object is available before accessing proper…
Browse files Browse the repository at this point in the history
…ties (#4779)
  • Loading branch information
wobsoriano authored Dec 14, 2024
1 parent faccaa1 commit dfdf23b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/fresh-olives-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/vue": patch
---

Fixed an issue when accessing Clerk properties inside composables before Clerk is available.
4 changes: 2 additions & 2 deletions packages/vue/src/composables/useSignIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ export const useSignIn: UseSignIn = () => {
});

const result = computed<UseSignInReturn>(() => {
if (!clientCtx.value) {
if (!clerk.value || !clientCtx.value) {
return { isLoaded: false, signIn: undefined, setActive: undefined };
}

return {
isLoaded: true,
signIn: clientCtx.value.signIn,
setActive: clerk.value!.setActive,
setActive: clerk.value.setActive,
};
});

Expand Down
4 changes: 2 additions & 2 deletions packages/vue/src/composables/useSignUp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ export const useSignUp: UseSignUp = () => {
});

const result = computed<UseSignUpReturn>(() => {
if (!clientCtx.value) {
if (!clerk.value || !clientCtx.value) {
return { isLoaded: false, signUp: undefined, setActive: undefined };
}

return {
isLoaded: true,
signUp: clientCtx.value.signUp,
setActive: clerk.value!.setActive,
setActive: clerk.value.setActive,
};
});

Expand Down

0 comments on commit dfdf23b

Please sign in to comment.