Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

componentDidCatch and errorInfo #2835

Closed
sqal opened this issue Nov 18, 2020 · 2 comments · Fixed by #3452
Closed

componentDidCatch and errorInfo #2835

sqal opened this issue Nov 18, 2020 · 2 comments · Fixed by #3452

Comments

@sqal
Copy link

sqal commented Nov 18, 2020

Hi. I have a question regarding componentDidCatch lifecycle hook. React's componentDidCatch receives two parameters, the first one is an error and the second is errorInfo which contains additional details about the error (like stack trace). I wanted to replace React with preact/compact in my app, however, I didn't manage to do it because I use @sentry/react package and its ErrorBoundry component relies on errorInfo parameter https://github.com/getsentry/sentry-javascript/blob/master/packages/react/src/errorboundary.tsx#L62 so missing errorInfo in preact simply crashes my app.

What's the reason for errorInfo not being present in Preact's componentDidCatch hook? Shouldn't preact/compat be 100% compatible with the React?

...preact/compat, which is a thin layer over Preact that attempts to achieve 100% compatibility with React.

@marvinhagemeister
Copy link
Member

What's the reason for errorInfo not being present in Preact's componentDidCatch hook? Shouldn't preact/compat be 100% compatible with the React?

Afaik there never was a conscious decision to leave that out. Looks more like something that got forgotten or overlooked, simple as that.

@donlion
Copy link

donlion commented Jan 27, 2021

Any news on this?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
3 participants