Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load Stripe.JS library asynchronously #2118

Draft
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

DeanMarkTaylor
Copy link

@DeanMarkTaylor DeanMarkTaylor commented Nov 5, 2021

As discussed in #2065 targeting performance issues of product and cart pages

Partially Fixes #2065

Intended to be separate from #2110 which is also addressing issues in #2065.

Changes proposed in this Pull Request:

Loads the Stripe.JS library asynchronously (with async attribute) as per the Stripe JS API recommendations
Targeting reduced "time to interactive" experience for users.

This is a work in-process sharing so others can review and test.

Known issues / incomplete

  • WARNING: Zero Testing - I have just typed the code and not tested at-all.
  • Low: There is a duplication of JavaScript code in assets/js/stripe.js and assets/js/stripe-pament-requiest.js. Unsure the value this there to break out duplicated code (extra HTTP request, async complexity). Probably a separate PR.
  • Change log updates
  • I have not generated the ".min.js" files (unsure of process)
  • What (if any) JavaScript code can be pulled out and not be dependent on the knowledge that Stripe.JS being loaded. (separate PRs?)

Testing instructions

So far this has not been tested at-all.

Because this directly impacts the loading of the main Stripe.JS library the main things to check are:

  • No console errors indicating problem loading "Stripe.JS"
  • Card brand logo updates when inputting CC details. (Indicates some JS has loaded)
  • Payment Request buttons load when expected on product page (again simply existing is positive indicator loading succeeded).
  • Checkout process completes (actual communication with Stripe, the library must have loaded).

  • Covered with tests (or have a good reason not to test in description ☝️)
  • Added changelog entry (or does not apply)
  • Tested on mobile (or does not apply)

Post merge

@lkraav
Copy link

lkraav commented Nov 6, 2021

Can you perhaps amend with removing whitespace-only changes so PR would become easier to evaluate 🙏

@DeanMarkTaylor
Copy link
Author

Can you perhaps amend with removing whitespace-only changes so PR would become easier to evaluate 🙏

Sure, this has been done.

The whitespace changes were automatically applied formatting for WordPress Coding Standards from the IDE.

@github-actions github-actions bot added the Stale label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unnecessary resources and HTTP requests on product and/or cart pages
2 participants