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

feat: error boundary #374

Merged
merged 5 commits into from
Aug 6, 2024
Merged

Conversation

solidovic
Copy link
Contributor

@solidovic solidovic commented Jun 27, 2024

Description

Catch any client-side errors via the concept of an "error boundary" and the NPM package "react-error-boundary".

Motivation of using "react-error-boundary"

The React error boundaries do not catch errors for:

  • Event handlers (learn more), e.g. onClick
  • Asynchronous code (e.g. setTimeout or requestAnimationFrame callbacks)

To solve this issue, use the 'useErrorBoundary' hook:
https://www.npmjs.com/package/react-error-boundary#useerrorboundary-hook

Demo (not actual right now)

  1. For the demo on stake page, there is a button that causes an error (features/stake/stake.tsx).
Снимок экрана 2024-06-27 в 12 35 45
  1. For the demo on the /wrap/unwrap page, there is a 'useEffect' that causes an error (features/wsteth/unwrap/unwrap-form/unwrap-form.tsx)

In Prod mode

Снимок экрана 2024-06-27 в 12 32 15

In Dev move

Снимок экрана 2024-06-27 в 12 33 22 Снимок экрана 2024-06-27 в 12 33 05

Checklist:

  • Checked the changes locally.
  • Created / updated analytics events.
  • Created / updated the technical documentation (README.md / docs / etc.).
  • Affects / requires changes in other services (Matomo / Sentry / CloudFlare / etc.).

Jeday
Jeday previously approved these changes Jun 28, 2024
shared/components/error-boundary/error-boundary.tsx Outdated Show resolved Hide resolved
@solidovic solidovic requested a review from Jeday July 3, 2024 07:15
@solidovic solidovic changed the title [DRAFT] feat: error boundary feat: error boundary Jul 3, 2024
@solidovic solidovic marked this pull request as ready for review July 3, 2024 07:18
@solidovic solidovic requested review from a team as code owners July 3, 2024 07:18
@preview-stands
Copy link

preview-stands bot commented Jul 3, 2024

Preview stand status

Stand was demolished

Jeday
Jeday previously approved these changes Jul 3, 2024
DiRaiks
DiRaiks previously approved these changes Jul 3, 2024
Copy link
Contributor

@DiRaiks DiRaiks left a comment

Choose a reason for hiding this comment

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

lgtm

@solidovic solidovic dismissed stale reviews from DiRaiks and Jeday via dd27bd6 August 6, 2024 10:42
@solidovic solidovic requested review from Jeday and DiRaiks August 6, 2024 10:54
@itaven itaven merged commit 5c7fc8b into develop Aug 6, 2024
6 checks passed
@itaven itaven deleted the feature/si-1438-add-global-error-handler branch August 6, 2024 11:16
@itaven itaven mentioned this pull request Aug 8, 2024
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