File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
packages/shared/src/react/hooks Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ '@clerk/shared': patch
3
+ ---
4
+
5
+ Improve `useCheckout` error messages on mount.
Original file line number Diff line number Diff line change @@ -53,14 +53,18 @@ export const useCheckout = (options?: Params): __experimental_UseCheckoutReturn
53
53
54
54
const clerk = useClerk();
55
55
const { organization } = useOrganization();
56
- const { user } = useUser();
56
+ const { isLoaded, user } = useUser();
57
+
58
+ if (!isLoaded) {
59
+ throw new Error('Clerk: Ensure that `useCheckout` is inside a component wrapped with `<ClerkLoaded />`.');
60
+ }
57
61
58
62
if (!user) {
59
- throw new Error('Clerk: User is not authenticated ');
63
+ throw new Error('Clerk: Ensure that `useCheckout` is inside a component wrapped with `<SignedIn />`. ');
60
64
}
61
65
62
66
if (forOrganization === 'organization' && !organization) {
63
- throw new Error('Clerk: Use `setActive` to set the organization');
67
+ throw new Error('Clerk: Wrap your flow with a check for an active organization');
64
68
}
65
69
66
70
const manager = useMemo(
You can’t perform that action at this time.
0 commit comments