Skip to content

Conversation

davidchin
Copy link
Contributor

@davidchin davidchin commented Jul 18, 2025

What/Why?

This PR introduces the ability to pre-populate the Checkout SDK with initial data during service creation, eliminating the need for client-side API calls on page load. Currently, the checkout microapp fetches all data client-side after the page loads, which is suboptimal because these requests can only be made after assets are loaded and parsed, and the page often already has this same data available.

// Before
const service = createCheckoutService();
await service.loadCheckout();
// After
const service = createCheckoutService();
await service.hydrateInitiateState({ checkout, config, formFields, extensions });

Rollout/Rollback

Revert or turn off CHECKOUT-9388.initial_state_for_checkout_app experiment

Testing

Before

This video shows that, before this change, the page required AJAX requests on initial load.

Screen.Recording.2025-09-29.at.1.20.44.pm.mov

This screenshot shows that the LCP is 2.3s before this change.

Screenshot 2025-10-01 at 12 35 54 pm

After

This video shows that, after this change, the page no longer makes AJAX requests during the initial load.

Screen.Recording.2025-09-29.at.1.09.04.pm.mov

This screenshot shows that the LCP is 1.2s after this change.

Screenshot 2025-10-01 at 12 33 10 pm

@davidchin davidchin force-pushed the initial_hydrate branch 9 times, most recently from 0218980 to 3ac5676 Compare July 31, 2025 06:15
@davidchin davidchin force-pushed the initial_hydrate branch 4 times, most recently from 656b87e to 9c6797c Compare August 4, 2025 06:31
@davidchin davidchin marked this pull request as ready for review September 24, 2025 03:59
@davidchin davidchin requested a review from a team as a code owner September 24, 2025 03:59
@davidchin davidchin changed the title CHECKOUT-9388: Add option to pass initial state during initialisation CHECKOUT-9513: Add option to pass initial state during initialisation Sep 24, 2025
@davidchin davidchin force-pushed the initial_hydrate branch 2 times, most recently from 9e32669 to 98fedcf Compare October 1, 2025 01:44
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