Closed kaiying-stripe closed 3 months ago
Yes! The difference is that if we want to disable this behavior, we can do it by shipping a connect.js change
On Thu, Jun 20, 2024 at 6:23 PM kaiying-stripe @.***> wrote:
@.**** commented on this pull request.
In src/shared.ts https://github.com/stripe/connect-js/pull/122#discussion_r1648307276:
@@ -138,8 +138,22 @@ export const initStripeConnect = ( stripePromise: Promise
, initParams: IStripeConnectInitParams ): StripeConnectInstanceExtended => {
- const clientSecretPromise = initParams.fetchClientSecret();
- let cachedClientSecretUsed = false;
- const fetchClientSecret = async () => {
If we pass in the promise as a metaOption, doesn't it still require the platform to update their SDK for it to take effect tho?
— Reply to this email directly, view it on GitHub https://github.com/stripe/connect-js/pull/122#discussion_r1648307276, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWXWRFYX3TAUMCK2IJMCL53ZIN57TAVCNFSM6AAAAABJTK33E6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDCMZRGYZTANZVGU . You are receiving this because you commented.Message ID: @.***>
Start fetching client secret without waiting on stripePromise, so that fetch client secret can go parallel with loading connect.js.
The eager fetching only applies for the first time of fetching client secret, or else when we attempt to refresh client secret, the returned secret could be stale.