Skip to content

Share the Apple Pay SDK load promise across ui.applePay() instances - #1008

Closed
Alexander (alexander-rw) wants to merge 1 commit into
masterfrom
alexander-rw/card-1239-apple-pay-second-uiapplepay-instance-caches-a-premature
Closed

Share the Apple Pay SDK load promise across ui.applePay() instances#1008
Alexander (alexander-rw) wants to merge 1 commit into
masterfrom
alexander-rw/card-1239-apple-pay-second-uiapplepay-instance-caches-a-premature

Conversation

@alexander-rw

Copy link
Copy Markdown
Contributor

Closes CARD-1239. A second ui.applePay() instance on the same page probed Apple's SDK before it had executed and then memoized the resulting "unsupported" forever, so the express-checkout button never mounted — the load promise is now shared across instances rather than per-instance, and only "available" is cached.

Reported by a customer via solutions-engineering; it reached CDN users on Sep 2 when js.evervault.com/v2 finally served 2.63.0.

@changeset-bot

changeset-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 724f088

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@evervault/browser Patch
@evervault/inputs Patch
example-apple-pay Patch
example-react-google-wallet Patch
@evervault/browser-e2e-tests Patch
e2e-tests-ui-components-vanilla-server Patch
@evervault/inputs-e2e-tests Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

A second ui.applePay() instance found the <script> tag the first had just
appended, treated it as loaded and probed applePayCapabilities before Apple's
SDK had executed, so availability() resolved "unsupported". e689131 then
memoized that result for the life of the instance, so retries never recovered
and the express-checkout button never mounted.

The load promise is now keyed on the script element rather than the instance,
so siblings wait on the same load event. A tag we did not inject is only
treated as ready once the SDK global exists, since an already-executed tag
never re-fires load; a short grace timer keeps that from stalling when the
global is never defined. Only "available" is memoized now, so a negative
result stays retryable.

Reported via solutions-engineering; reached CDN users on Sep 2 when
js.evervault.com/v2 finally served @evervault/browser@2.63.0.
@alexander-rw

Copy link
Copy Markdown
Contributor Author

Superseded by #1012, which carries the same fix for CARD-1239. Closing this duplicate; #1010 stacks on #1012.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant