Skip to content

Conversation

davidchin
Copy link
Contributor

@davidchin davidchin commented Jul 10, 2025

What/Why?

This PR leverages the Checkout SDK’s new capability to hydrate CheckoutService with initial state from the server. This eliminates client-side API calls on page load, resulting in faster performance and an improved user experience.

See bigcommerce/checkout-sdk-js#2934

Rollout/Rollback

Revert or turn off CHECKOUT-9388.initial_state_for_checkout_app experiment

Testing

CircleCI

@bcsnyk
Copy link
Contributor

bcsnyk commented Jul 10, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@davidchin davidchin force-pushed the initial_hydrate branch 15 times, most recently from 8cef4fe to 4fa5c57 Compare July 17, 2025 06:49
@davidchin davidchin force-pushed the initial_hydrate branch 10 times, most recently from 55cf71b to 9c8e772 Compare July 31, 2025 06:30
@davidchin davidchin force-pushed the initial_hydrate branch 4 times, most recently from 8223d30 to 6639157 Compare August 4, 2025 06:38
@davidchin davidchin force-pushed the initial_hydrate branch 4 times, most recently from 6d17003 to 9320729 Compare September 25, 2025 23:38
@davidchin davidchin marked this pull request as ready for review September 25, 2025 23:53
@davidchin davidchin requested review from a team as code owners September 25, 2025 23:53
@davidchin davidchin force-pushed the initial_hydrate branch 8 times, most recently from e49c742 to 95ad839 Compare October 2, 2025 00:42
@davidchin davidchin force-pushed the initial_hydrate branch 3 times, most recently from 2963db3 to 993511f Compare October 8, 2025 01:56
throw error;
});
} else {
requestAnimationFrame(async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why we need to wrap the initial render and hydration calls in requestAnimationFrame?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to spread the work across multiple tasks so we don't do too much in a single one, as this could negatively impact Total Blocking Time. Having said that, I notice I'm using two, so I'll look into whether I need both.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I checked. We do need do break up the task in both places. But I found that requestAnimationFrame is not the most ideal. scheduler.yield (https://developer.mozilla.org/en-US/docs/Web/API/Scheduler/yield) is a better option.

animesh1987
animesh1987 previously approved these changes Oct 8, 2025
@davidchin davidchin merged commit cfcea64 into master Oct 9, 2025
10 checks passed
@davidchin davidchin deleted the initial_hydrate branch October 9, 2025 01:11
@bc-launchbay
Copy link

checkout-js deployed to Integration US
success 20251009012955 by Launchbay

@bc-launchbay
Copy link

checkout-js deployed to Staging US
success 20251009012955 by Launchbay

Copy link

github-actions bot commented Oct 9, 2025

⚡️ Lighthouse results

🖥️ Desktop:

Category Score
🟠 Performance 88
🟢 Accessibility 91
🟠 Best practices 78

📱 Mobile:

Category Score
🟠 Performance 60
🟢 Accessibility 94
🟠 Best practices 78

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.

4 participants