Skip to content

fix(error-handling): Auto-recover from browser extension DOM errors - #4124

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/dom-error-recovery
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/dom-error-recovery

Conversation

@sentry

@sentry sentry Bot commented Sep 13, 2026

Copy link
Copy Markdown

Description

This PR implements a solution for NotFoundErrors (specifically insertBefore and removeChild failures) that occur due to browser extensions directly manipulating React-managed DOM nodes. The root cause of these errors was identified as browser extensions interfering with React's DOM management. Previously, these errors would trigger a full error fallback UI for the user and generate non-actionable alerts in Sentry. This fix improves user experience by silently recovering from these transient issues and cleans up Sentry data by filtering irrelevant errors.

Code Example

N/A

Notable Changes

  1. Sentry Event Filtering: Modified src/sentry.ts to filter out NotFoundError events with messages containing insertBefore or removeChild in the beforeSend hook. These errors are caused by third-party browser extensions and are not actionable application bugs, reducing Sentry noise.
  2. Auto-Recovery Error Boundary: Introduced a new ErrorBoundaryWithRecovery class component in src/layouts/shared/ErrorBoundary/ErrorBoundaryWithRecovery.tsx. This component catches the specific NotFoundErrors and automatically forces a remount of its children (up to 2 retries) by updating a retryKey. This allows React to re-render the component tree from a clean state, effectively recovering from the DOM desynchronization.
  3. Integration: The existing ErrorBoundary in src/layouts/shared/ErrorBoundary/ErrorBoundary.tsx now wraps its Sentry.ErrorBoundary with the new ErrorBoundaryWithRecovery. This ensures that all existing uses of our ErrorBoundary benefit from the auto-recovery mechanism without requiring changes at individual call sites.

Screenshots

N/A

Link to Sample Entry

N/A

Legal Boilerplate

Look, I get it. The entity doing business as "Codecov" is owned by Harness, Inc. In 2026 Harness acquired Codecov and as a result Harness is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Harness can use, modify, copy, and redistribute my contributions, under Harness's choice of terms.

Fixes GAZEBO-1871

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@sentry

sentry Bot commented Sep 13, 2026

Copy link
Copy Markdown
Author

⚠️ Seer needs additional GitHub permissions

Seer wants to keep iterating on this pull request to get CI passing, but the Sentry GitHub App installation is missing permissions it needs to read the failing checks and push a fix.

Review and accept the updated permissions to let Seer continue: https://github.com/organizations/codecov/settings/installations/86101127/permissions/update

@codecov

codecov Bot commented Sep 13, 2026

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 1.31kB (0.01%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-system 5.82MB 606 bytes (0.01%) ⬆️
gazebo-production-esm 5.9MB 701 bytes (0.01%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: gazebo-production-system

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index-legacy.*.js 606 bytes 658.42kB 0.09%

Files in assets/index-legacy.*.js:

  • ./src/layouts/shared/ErrorBoundary/ErrorBoundaryWithRecovery.tsx → Total Size: 700 bytes

  • ./src/layouts/shared/ErrorBoundary/ErrorBoundary.tsx → Total Size: 1.34kB

  • ./src/sentry.ts → Total Size: 5.28kB

view changes for bundle: gazebo-production-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index.*.js 701 bytes 578.51kB 0.12%

Files in assets/index.*.js:

  • ./src/layouts/shared/ErrorBoundary/ErrorBoundary.tsx → Total Size: 1.34kB

  • ./src/sentry.ts → Total Size: 5.27kB

  • ./src/layouts/shared/ErrorBoundary/ErrorBoundaryWithRecovery.tsx → Total Size: 700 bytes

@codecov-notifications

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 10 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...shared/ErrorBoundary/ErrorBoundaryWithRecovery.tsx 28.57% 5 Missing and 5 partials ⚠️
@@            Coverage Diff             @@
##             main    #4124      +/-   ##
==========================================
- Coverage   98.77%   98.70%   -0.07%     
==========================================
  Files         823      824       +1     
  Lines       15147    15161      +14     
  Branches     4387     4386       -1     
==========================================
+ Hits        14961    14965       +4     
- Misses        179      184       +5     
- Partials        7       12       +5     
Files with missing lines Coverage Δ
src/layouts/shared/ErrorBoundary/ErrorBoundary.tsx 100.00% <100.00%> (ø)
...shared/ErrorBoundary/ErrorBoundaryWithRecovery.tsx 28.57% <28.57%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 97.05% <33.33%> (-2.67%) ⬇️
Pages 98.43% <ø> (ø)
Services 99.32% <ø> (ø)
Shared 98.94% <ø> (ø)
UI 99.02% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b8fbfc0...89e774d. Read the comment docs.

@codecov

codecov Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.70%. Comparing base (b8fbfc0) to head (89e774d).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...shared/ErrorBoundary/ErrorBoundaryWithRecovery.tsx 28.57% 5 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4124      +/-   ##
==========================================
- Coverage   98.77%   98.70%   -0.07%     
==========================================
  Files         823      824       +1     
  Lines       15147    15161      +14     
  Branches     4387     4394       +7     
==========================================
+ Hits        14961    14965       +4     
- Misses        179      184       +5     
- Partials        7       12       +5     
Files with missing lines Coverage Δ
src/layouts/shared/ErrorBoundary/ErrorBoundary.tsx 100.00% <100.00%> (ø)
...shared/ErrorBoundary/ErrorBoundaryWithRecovery.tsx 28.57% <28.57%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 97.05% <33.33%> (-2.67%) ⬇️
Pages 98.43% <ø> (ø)
Services 99.32% <ø> (ø)
Shared 98.94% <ø> (ø)
UI 99.02% <ø> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b8fbfc0...89e774d. Read the comment docs.

@codecov-public-qa

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 33.33333% with 10 lines in your changes missing coverage. Please review.

Project coverage is 98.70%. Comparing base (b8fbfc0) to head (89e774d).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...shared/ErrorBoundary/ErrorBoundaryWithRecovery.tsx 28.57% 5 Missing and 5 partials ⚠️
@@            Coverage Diff             @@
##             main    #4124      +/-   ##
==========================================
- Coverage   98.77%   98.70%   -0.07%     
==========================================
  Files         823      824       +1     
  Lines       15147    15161      +14     
  Branches     4379     4386       +7     
==========================================
+ Hits        14961    14965       +4     
- Misses        179      184       +5     
- Partials        7       12       +5     
Files with missing lines Coverage Δ
src/layouts/shared/ErrorBoundary/ErrorBoundary.tsx 100.00% <100.00%> (ø)
...shared/ErrorBoundary/ErrorBoundaryWithRecovery.tsx 28.57% <28.57%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 97.05% <33.33%> (-2.67%) ⬇️
Pages 98.43% <ø> (ø)
Services 99.32% <ø> (ø)
Shared 98.94% <ø> (ø)
UI 99.02% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b8fbfc0...89e774d. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codecov-releaser

Copy link
Copy Markdown
Collaborator

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
89e774d Sun, 13 Sep 2026 12:49:44 GMT Cloud Enterprise

@codecov-qa

codecov-qa Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.70%. Comparing base (b8fbfc0) to head (89e774d).

Files with missing lines Patch % Lines
...shared/ErrorBoundary/ErrorBoundaryWithRecovery.tsx 28.57% 5 Missing and 5 partials ⚠️
@@            Coverage Diff             @@
##             main    #4124      +/-   ##
==========================================
- Coverage   98.77%   98.70%   -0.07%     
==========================================
  Files         823      824       +1     
  Lines       15147    15161      +14     
  Branches     4387     4394       +7     
==========================================
+ Hits        14961    14965       +4     
- Misses        179      184       +5     
- Partials        7       12       +5     
Files with missing lines Coverage Δ
src/layouts/shared/ErrorBoundary/ErrorBoundary.tsx 100.00% <100.00%> (ø)
...shared/ErrorBoundary/ErrorBoundaryWithRecovery.tsx 28.57% <28.57%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 97.05% <33.33%> (-2.67%) ⬇️
Pages 98.43% <ø> (ø)
Services 99.32% <ø> (ø)
Shared 98.94% <ø> (ø)
UI 99.02% <ø> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b8fbfc0...89e774d. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant