question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error boundary UI has no space between button and report link

See original GitHub issue

Bug Description

It seems that when we updated our styles to GM2+ we lost some styling that we had in our error boundary component that looks a bit off now.

Steps to reproduce

  1. Trigger an error to view the error boundary
  2. See styling issue below

Screenshots

image

Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The error boundary component styling should be updated as follows:
    • There should be an appropriate spacing between the main CTA button and the link to “Report this problem” based on the grid gap for the viewport
    • The text in the CTA button and the link should be vertically aligned
  • A story should be added for the error handler (we used to have one) with an accompanying VRT scenario

Implementation Brief

  • In assets/js/components/ErrorHandler/index.js:
    • Add a className prop to the <Notification /> prop with the class googlesitekit-error-handler.
  • In assets/sass/components/global, create a new file named _googlesitekit-error-handler.scss. In this file:
    • Add styles for the .googlesitekit-error-handler class so that its descendant class .googlesitekit-cta-link has a margin-left of $grid-gap-mobile, and $grid-gap-desktop with a minimum viewport width of $bp-tablet.
    • The text for the button and the link should already be vertically aligned, but if they’re not, add necessary styles.
  • In assets/sass/admin.scss:
    • Import the newly created _googlesitekit-error-handler.scss file.
  • In assets/js/components/ErrorHandler folder, create a new file named index.stories.js. In this file:
    • Export a story with the <ErrorHandler /> component containing an <ErrorComponent /> component.
    • In the story decorator, simulate a click on the button in the <ErrorHandler /> component, thus setting the shouldThrow prop to true.
    • The exported story should also have a scenario property for the VRT scenario, with appropriate label, and delay if required.
      • The VRT scenario should use the clickSelector as seen in use here to click on the button to trigger the error in the VRT scenario.

Test Coverage

  • No tests need to be added/updated.
  • Update VRT references to include a reference for the new <ErrorHandler /> story.

QA Brief

  • Verify the Components/ErrorHandler Storybook story.
  • Verify that there is the appropriate spacing between the CTA and the report link.

QA:Eng

  • To trigger an error, place the <ErrorComponent /> component somewhere within the application, say <BannerNotifications />.
  • Go to the Site Kit Dashboard and click on Simulate an error.
  • Once the error appears, verify that there is spacing between the CTA and the report link.
  • Verify that the said spacing is appropriate based on the viewport.

Changelog entry

  • Update the error boundary component styling to provide appropriate spacing between the main CTA button and the link to “Report this problem”.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
techanvilcommented, Oct 17, 2022

Hi @nfmohit, the IB is looking good. One suggestion:

Rather than adding more functionality to ErrorComponent while the existing behaviour is unused, how about allowing the existing behaviour of clicking the button to trigger the error to be used in the story, and using clickSelector as seen in use here to click on the button to trigger the error in the VRT scenario?

0reactions
jimmymadoncommented, Oct 28, 2022

QA Eng ✅

Verified:

  • Created an error using the new <ErrorComponent: Screenshot 2022-10-28 at 15 14 07

  • Triggered a normal error as well. Tested on desktop, tablet and mobile: Screenshot 2022-10-28 at 15 15 44 Screenshot 2022-10-28 at 15 19 01 Screenshot 2022-10-28 at 15 17 59

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Boundaries - React
Error boundaries are React components that catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI...
Read more >
React error handling with react-error-boundary - LogRocket Blog
So error boundaries only catch errors that occur in a lifecycle method, render method, and inside Hooks like useEffect .
Read more >
How To Use Error Boundaries in React - DigitalOcean
Learn about Error Boundaries in React which allow components to degrade gracefully in cases of errors.
Read more >
React Native: Working with Error Boundaries | by Ross Bulat
Error boundaries act as fallback UI when errors occur​​ These fallback screens can then give the user a friendly explanation that something indeed...
Read more >
Understanding React's Error Boundaries - DEV Community ‍ ‍
So let's create a very simple UI where we have two sections: News and Chat . Both sections have a button that will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found