million icon indicating copy to clipboard operation
million copied to clipboard

feat: Error boundaries

Open aidenybai opened this issue 1 year ago • 2 comments

https://github.com/aidenybai/million-react/issues/6

aidenybai avatar Jul 30 '22 16:07 aidenybai

FYI, preact implements a useErrorBoundary to catch error during rendering: https://preactjs.com/guide/v10/hooks/#useerrorboundary

https://github.com/preactjs/preact/blob/0406941612c12f1056e9f1f00c62030c591dd085/hooks/src/index.js#L319

However, preact still implements it based on componentDidCatch.

It is possible to implement a similar solution, but it won't be a drop-in replacement for react.

SukkaW avatar Jul 30 '22 16:07 SukkaW

I did a very basic PoC that adds componentDidCatch to class components from errors caught on render.

I'm not sure if adding a useErrorBoundary hook makes sense for Million? (And not sure if it’s currently possible, will have to dig a bit more)

QuiiBz avatar Aug 02 '22 19:08 QuiiBz