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

[AXON-41] Implement AtlascodeErrorBoundary #58

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

sdzh-atlassian
Copy link
Member

@sdzh-atlassian sdzh-atlassian commented Dec 24, 2024

What is this?

This is the 1st PR in a series related to improving our observability when something goes wrong.

In React, there's a concept of an Error Boundary - a special component which is intended to address rendering errors in the tree, and which is very notably missing in our pages 😉

Further, we are already pulling @atlaskit/analytics-next as a dependency, which conveniently offers an implementation we could use.

After the changes in this PR, we can receive an event with some data on rendering errors occuring in prod:
image

⚠️ Note: The exact structure and content of the analytics event are temporary and subject to change

What does this PR have, mechanically?

  • Basic support for firing error-related events from webviews with this architecture:
    image
    • New "common" action type SendAnalytics
    • Handling for it in all controllers
    • Type definitions
  • AtlascodeErrorBoundary implementation and usage

What is notably NOT included here?

  • Tests - I ran into dependency conflicts when trying to pull react testing utils. Might make sense to add them in a separate PR after bumping react version
  • AtlascodeErrorBoundary usage in other pages - to not overwhelm reviewers further ;D

How was this tested?

I've introduced the new error boundary to our Settings page, and then added a special component that fails on rendering. With that, when running our settings page, it was possible to show alternative HTML on render errors, while also receiving an event in the analityics service:

image
(all the extra components were removed during clean-up)

@sdzh-atlassian sdzh-atlassian force-pushed the AXON-41-atlascode-error-boundary branch 3 times, most recently from a092942 to 3865a53 Compare December 24, 2024 01:16
* Add support to receive rendering error events from UI
* Add AtlascodeErrorBoundary component
* Put the new boundary to Settings page
@sdzh-atlassian sdzh-atlassian force-pushed the AXON-41-atlascode-error-boundary branch from 3865a53 to 3a11fea Compare December 24, 2024 18:28
Copy link
Collaborator

@bwieger-atlassian-com bwieger-atlassian-com left a comment

Choose a reason for hiding this comment

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

Some questions

Copy link
Member Author

@sdzh-atlassian sdzh-atlassian left a comment

Choose a reason for hiding this comment

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

oh my god it took so long to figure out how to submit pending comments 💀

src/react/atlascode/common/ErrorBoundary.tsx Show resolved Hide resolved
src/react/atlascode/common/ErrorBoundary.tsx Show resolved Hide resolved
Copy link
Collaborator

@bwieger-atlassian-com bwieger-atlassian-com left a comment

Choose a reason for hiding this comment

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

Approving so you can move forward.

I am concerned about the 150 stack limit being too low.

@sdzh-atlassian sdzh-atlassian merged commit ea9cf35 into main Jan 3, 2025
2 checks passed
@sdzh-atlassian sdzh-atlassian deleted the AXON-41-atlascode-error-boundary branch January 3, 2025 21:26
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.

2 participants