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

ErrorBoundary fallback renders twice #440

Closed
andreiborza opened this issue Jun 7, 2024 · 2 comments
Closed

ErrorBoundary fallback renders twice #440

andreiborza opened this issue Jun 7, 2024 · 2 comments

Comments

@andreiborza
Copy link

Describe the bug

The ErrorBoundary fallback component renders twice when using solid router and navigating to a route that has an ErrorBoundary with an error.

Your Example Website or App

https://codesandbox.io/p/devbox/nameless-forest-45lzdm?file=%2Fsrc%2Findex.tsx%3A11%2C35

Steps to Reproduce the Bug or Issue

  1. Open console
  2. Click on the Go to error link

Expected behavior

Error should only be logged out once but is logged out twice.

Screenshots or Videos

CleanShot.2024-06-07.at.12.18.46.mp4

Platform

  • OS: macOS
  • Browser: Chrome
  • Version: [e.g. 91.1]

Additional context

Possibly related to: solidjs/solid#1586

andreiborza added a commit to getsentry/sentry-javascript that referenced this issue Jun 10, 2024
To automatically capture exceptions from inside a component tree and
render a fallback component, wrap the native Solid
JS `ErrorBoundary` component with `Sentry.withSentryErrorBoundary`.

```js
import * as Sentry from '@sentry/solidjs';
import { ErrorBoundary } from 'solid-js';

Sentry.init({
  dsn: '__PUBLIC_DSN__',
  tracesSampleRate: 1.0, //  Capture 100% of the transactions
});

const SentryErrorBoundary = Sentry.withSentryErrorBoundary(ErrorBoundary);

render(
  () => (
    <SentryErrorBoundary fallback={err => <div>Error: {err.message}</div>}>
      <ProblematicComponent />
    </SentryErrorBoundary>
  ),
  document.getElementById('root'),
);
```

**Note**: When using an `ErrorBoundary` in conjunction with Solid
Router, the fallback component renders twice, see
[here](solidjs/solid-router#440).
billyvg pushed a commit to getsentry/sentry-javascript that referenced this issue Jun 10, 2024
To automatically capture exceptions from inside a component tree and
render a fallback component, wrap the native Solid
JS `ErrorBoundary` component with `Sentry.withSentryErrorBoundary`.

```js
import * as Sentry from '@sentry/solidjs';
import { ErrorBoundary } from 'solid-js';

Sentry.init({
  dsn: '__PUBLIC_DSN__',
  tracesSampleRate: 1.0, //  Capture 100% of the transactions
});

const SentryErrorBoundary = Sentry.withSentryErrorBoundary(ErrorBoundary);

render(
  () => (
    <SentryErrorBoundary fallback={err => <div>Error: {err.message}</div>}>
      <ProblematicComponent />
    </SentryErrorBoundary>
  ),
  document.getElementById('root'),
);
```

**Note**: When using an `ErrorBoundary` in conjunction with Solid
Router, the fallback component renders twice, see
[here](solidjs/solid-router#440).
@ryansolid
Copy link
Member

ryansolid commented Jun 18, 2024

Looks like issue is also closed by #442. I will have a release out shortly.

@andreiborza
Copy link
Author

Can confirm, it's fixed!

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

No branches or pull requests

2 participants