Skip to content

Commit d58b959

Browse files
authored
chore(types,clerk-js): Make finalize from useCheckout awaitable (#6422)
1 parent 8fadb1d commit d58b959

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.changeset/fuzzy-views-pay.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
'@clerk/types': patch
4+
---
5+
6+
Make `.finalize()` from useCheckout to return a Promise.

packages/clerk-js/src/core/modules/checkout/instance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function createCheckoutInstance(
6464

6565
const finalize = (params?: { redirectUrl: string }) => {
6666
const { redirectUrl } = params || {};
67-
void clerk.setActive({ session: clerk.session?.id, redirectUrl });
67+
return clerk.setActive({ session: clerk.session?.id, redirectUrl });
6868
};
6969

7070
const clear = () => manager.clearCheckout();

packages/types/src/clerk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export type __experimental_CheckoutInstance = {
9191
confirm: (params: ConfirmCheckoutParams) => Promise<CheckoutResult>;
9292
start: () => Promise<CheckoutResult>;
9393
clear: () => void;
94-
finalize: (params?: { redirectUrl: string }) => void;
94+
finalize: (params?: { redirectUrl: string }) => Promise<void>;
9595
subscribe: (listener: (state: __experimental_CheckoutCacheState) => void) => () => void;
9696
getState: () => __experimental_CheckoutCacheState;
9797
};

0 commit comments

Comments
 (0)