Skip to content

Await checkout bridge JavaScript evaluation#250

Closed
kieran-osgood-shopify wants to merge 1 commit into
mainfrom
kieran-osgood/checkout-bridge/evaluate-js-completion
Closed

Await checkout bridge JavaScript evaluation#250
kieran-osgood-shopify wants to merge 1 commit into
mainfrom
kieran-osgood/checkout-bridge/evaluate-js-completion

Conversation

@kieran-osgood-shopify
Copy link
Copy Markdown
Contributor

@kieran-osgood-shopify kieran-osgood-shopify commented Jun 2, 2026

What changes are you making?

Await WKWebView.evaluateJavaScript when dispatching checkout bridge messages.

CheckoutBridge.sendMessage(_ webView:...) now uses the async WebKit API and returns whether evaluation completed successfully. Failures are logged and returned as false.

For the presented event, CheckoutWebView tracks an in-flight dispatch and only marks presentedEventDidDispatch after JavaScript evaluation completes successfully. This avoids treating the event as dispatched before WebKit has actually evaluated it.

The tests now await the production sendMessage(_ webView:...) entrypoint directly, avoiding the previous async XCTest expectation without adding a test-only sendMessage overload.

How to test

dev swift test CheckoutBridgeTests

dev swift test CheckoutWebViewTests


Before you merge

Important

  • I've added tests to support my implementation
  • I have read and agree with the Contribution Guidelines
  • I have read and agree with the Code of Conduct
  • I've updated the relevant platform README (platforms/swift/README.md and/or platforms/android/README.md)

Releasing a new Swift version?
  • I have bumped the version in ShopifyCheckoutKit.podspec
  • I have bumped the version in platforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swift
  • I have updated platforms/swift/CHANGELOG.md
  • I have updated the SwiftPM/CocoaPods version snippets in platforms/swift/README.md (major version only)
Releasing a new Android version?
  • I have bumped the versionName in platforms/android/lib/build.gradle
  • I have updated platforms/android/CHANGELOG.md
  • I have updated the Gradle/Maven version snippets in platforms/android/README.md

Tip

See the Contributing documentation for the full release process per platform.

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

React Native — Coverage Report

Lines Statements Branches Functions
Coverage: 92%
91.59% (316/345) 87.25% (178/204) 100% (82/82)

@kieran-osgood-shopify kieran-osgood-shopify marked this pull request as ready for review June 2, 2026 17:02
@kieran-osgood-shopify kieran-osgood-shopify requested a review from a team as a code owner June 2, 2026 17:02
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/checkout-bridge/evaluate-js-completion branch from 9d5c7ef to 4e422ba Compare June 2, 2026 17:07
@kieran-osgood-shopify kieran-osgood-shopify changed the title Handle checkout bridge JavaScript completion Await checkout bridge JavaScript evaluation Jun 2, 2026
@kiftio
Copy link
Copy Markdown
Contributor

kiftio commented Jun 3, 2026

After discussing, we're going to remove this code in #251

@kiftio kiftio closed this Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants