File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
packages/shared/src/react Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @clerk/shared ' : patch
3
+ ' @clerk/nextjs ' : patch
4
+ ' @clerk/clerk-react ' : patch
5
+ ---
6
+
7
+ Fixes a bug which cause initialization of a payment method to never fire.
Original file line number Diff line number Diff line change @@ -74,18 +74,21 @@ const usePaymentSourceUtils = (forResource: ForPayerType = 'user') => {
74
74
key : 'commerce-payment-source-initialize' ,
75
75
resourceId : resource ?. id ,
76
76
} ,
77
- ( ) =>
78
- resource ?. initializePaymentSource ( {
77
+ ( ) => {
78
+ return resource ?. initializePaymentSource ( {
79
79
gateway : 'stripe' ,
80
- } ) ,
80
+ } ) ;
81
+ } ,
81
82
) ;
83
+
82
84
const environment = useInternalEnvironment ( ) ;
83
85
84
86
useEffect ( ( ) => {
87
+ if ( ! resource ?. id ) return ;
85
88
initializePaymentSource ( ) . catch ( ( ) => {
86
89
// ignore errors
87
90
} ) ;
88
- } , [ ] ) ;
91
+ } , [ resource ?. id ] ) ;
89
92
90
93
const externalGatewayId = initializedPaymentSource ?. externalGatewayId ;
91
94
const externalClientSecret = initializedPaymentSource ?. externalClientSecret ;
You can’t perform that action at this time.
0 commit comments