File tree Expand file tree Collapse file tree
packages/shared/src/react/hooks Expand file tree Collapse file tree 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
5353
5454 const clerk = useClerk ( ) ;
5555 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+ }
5761
5862 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 />`. ' ) ;
6064 }
6165
6266 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' ) ;
6468 }
6569
6670 const manager = useMemo (
You can’t perform that action at this time.
0 commit comments