Title: withErrorBoundary create unnecessary rerenders · Issue #17183 · getsentry/sentry-javascript · GitHub
Open Graph Title: withErrorBoundary create unnecessary rerenders · Issue #17183 · getsentry/sentry-javascript
X Title: withErrorBoundary create unnecessary rerenders · Issue #17183 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using the latest SDK release https://github.com/...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/17183
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"withErrorBoundary create unnecessary rerenders","articleBody":"### Is there an existing issue for this?\n\n- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [x] I have reviewed the documentation https://docs.sentry.io/\n- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n\n@sentry/react\n\n### SDK Version\n\n8.55.0\n\n### Framework Version\n\n8.55.0\n\n### Link to Sentry event\n\n_No response_\n\n### Reproduction Example/SDK Setup\n\n```tsx\nexport const MyScreenWithFallback = Sentry.withErrorBoundary(MyScreen, {\n fallback: FatalErrorFallback,\n});\n```\n\n### Steps to Reproduce\n\n1. Run this with dummy components\n\n### Expected Result\n\n`MyScreenWithFallback` does not rerender when props are identical.\n\n### Actual Result\n\n`MyScreenWithFallback` rerenders everytime.\n\n### Workaround\n\n```tsx\nexport const MyScreenWithFallback = React.memo(Sentry.withErrorBoundary(MyScreen, {\n fallback: FatalErrorFallback,\n}));\n```\n\n### Real solution\n\n```js\nfunction withErrorBoundary(\n WrappedComponent,\n errorBoundaryOptions,\n) {\n const componentDisplayName = WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n const Wrapped = React.memo(((props) => React.createElement(ErrorBoundary, { ...errorBoundaryOptions,}\n , React.createElement(WrappedComponent, { ...props,} )\n )\n ));\n\n Wrapped.displayName = `errorBoundary(${componentDisplayName})`;\n\n // Copy over static methods from Wrapped component to Profiler HOC\n // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(Wrapped, WrappedComponent);\n return Wrapped;\n}\n```\n\n\n","author":{"url":"https://github.com/OoDeLally","@type":"Person","name":"OoDeLally"},"datePublished":"2025-07-28T08:08:06Z","url":"https://github.com/getsentry/sentry-javascript/issues/17183"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3ac57e3f-8f87-5a56-d8f2-55acfaab0cde |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C75A:A9D1F:5B52C7:7BE213:6B05E275 |
| html-safe-nonce | 9379912133ea53c7d0536c8c9e2525103cc3366d0c99bef79e59c6f17eeba1d6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzVBOkE5RDFGOjVCNTJDNzo3QkUyMTM6NkIwNUUyNzUiLCJ2aXNpdG9yX2lkIjoiNDI1Mzg4NDgxNDYyMjg0MzUwOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 730916699272c5a8ce758d882929ddbb1d7b214b9ee04355be56846357999880 |
| hovercard-subject-tag | issue:3268660009 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/17183/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c1baedc7bab9de8e2ef36c1fc72f6778082026a860e8c3a0cedb1fe463fd8a4c/getsentry/sentry-javascript/issues/17183 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c1baedc7bab9de8e2ef36c1fc72f6778082026a860e8c3a0cedb1fe463fd8a4c/getsentry/sentry-javascript/issues/17183 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | OoDeLally |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9e6b0e6e5a9a8e0ddb968297ede4e2eac72d30ea174a0970eb8f22d6958e91e3 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 023691d14ad20c90d3ee61b0a0977b17dc6b6361 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width