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

composite-checkout: Add error boundary around top level (1) #43268

Merged
merged 3 commits into from Jun 15, 2020

Conversation

sirbrillig
Copy link
Member

Changes proposed in this Pull Request

This adds a React error boundary around the entire component tree of composite checkout starting at CheckoutSystemDecider. Hopefully this will never be hit because composite checkout already has several layers of error boundaries within CheckoutProvider but it will give us the opportunity to:

  1. Prevent the user from seeing a blank screen if something at the top level fails.
  2. Record such errors and report them to logstash where they will ping us in Slack.

Testing instructions

  • Trigger a fatal error inside the CompositeCheckout component itself.
  • Verify that the logstash logs for the string composite checkout load error get a new entry.

@matticbot
Copy link
Contributor

@sirbrillig sirbrillig self-assigned this Jun 14, 2020
@sirbrillig sirbrillig added [Feature] Checkout The checkout screen and process for purchases made on WordPress.com. [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jun 14, 2020
@matticbot
Copy link
Contributor

matticbot commented Jun 14, 2020

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

Sections (~83 bytes added 📈 [gzipped])

name      parsed_size           gzip_size
checkout       +391 B  (+0.0%)      +83 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.

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.

Copy link
Member

@michaeldcain michaeldcain left a comment

Choose a reason for hiding this comment

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

With the import fixed, this works as expected. The correct message appears on both the page and in the logs. Let's watch the logs after this merges, it might be nice to make the message more helpful for the user if we see a number of these.

client/my-sites/checkout/checkout-system-decider.js Outdated Show resolved Hide resolved
Co-authored-by: Michael Cain <cain@automattic.com>
@sirbrillig
Copy link
Member Author

Thanks! I clearly didn't have time to test this last night.

Copy link
Member

@michaeldcain michaeldcain left a comment

Choose a reason for hiding this comment

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

Tested, works as described. LGTM.

@michaeldcain michaeldcain added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jun 15, 2020
@sirbrillig sirbrillig merged commit 61697db into master Jun 15, 2020
@sirbrillig sirbrillig deleted the add/checkout-error-boundary-at-system-decider branch June 15, 2020 15:17
@a8ci18n
Copy link

a8ci18n commented Jun 15, 2020

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/3848930

Hi @sirbrillig, could you please edit the description of this PR and add a screenshot for our translators? Ideally it'd include this string: Sorry, there was an error loading this page.

Thank you in advance!

@michaeldcain michaeldcain changed the title composite-checkout: Add error boundary around top level composite-checkout: Add error boundary around top level (1) Jun 16, 2020
@a8ci18n
Copy link

a8ci18n commented Aug 4, 2020

Translation for this Pull Request has now been finished.

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants