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

Checkout: Stop memoizing domainDetails for existingCardProcessor #48428

Merged
merged 1 commit into from
Dec 16, 2020

Conversation

sirbrillig
Copy link
Member

@sirbrillig sirbrillig commented Dec 16, 2020

Changes proposed in this Pull Request

Make sure domain details for existing card purchases is always up-to-date. Otherwise if the contact details are modified and the cart doesn't change, the domain details submitted to the transactions endpoint will be out-of-date, resulting in weird errors about missing data when there's clearly no data missing.

The underlying issue is that getDomainDetails is not a pure function. It fetches data from a @wordpress/data store and so it has a hidden dependency that isn't in the dependencies for useMemo.

This was a regression added by #48069

Testing instructions

  • Purchase a .ca TLD using an existing card.
  • Make sure that the purchase completes with no errors.

@sirbrillig sirbrillig requested a review from a team as a code owner December 16, 2020 19:47
@matticbot
Copy link
Contributor

@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Dec 16, 2020
@sirbrillig sirbrillig self-assigned this Dec 16, 2020
@sirbrillig sirbrillig added [Type] Bug [Feature] Checkout The checkout screen and process for purchases made on WordPress.com. labels Dec 16, 2020
@sirbrillig sirbrillig merged commit ad85fa0 into trunk Dec 16, 2020
@sirbrillig sirbrillig deleted the fix/domain-details-existing-card-proc branch December 16, 2020 20:00
@matticbot
Copy link
Contributor

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~10 bytes removed 📉 [gzipped])

name      parsed_size           gzip_size
checkout        -31 B  (-0.0%)      -10 B  (-0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~8 bytes removed 📉 [gzipped])

name                                             parsed_size           gzip_size
async-load-calypso-blocks-editor-checkout-modal        -31 B  (-0.0%)       -8 B  (-0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Checkout The checkout screen and process for purchases made on WordPress.com. [Type] Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants