Open glenjamin opened 8 years ago
I originally tried to use redbox
as a component, but you can't just try..catch
in render(), so that didn't work.
I then had a go with https://github.com/facebook/react/issues/2461 - the new core feature for error boundaries, but it isn't finished yet.
I'm going to put this back on ice for now. It's possible to write an error catcher component that would communicate with the parent card - but that's a bit fiddly so I think i'll wait and see what 0.15 looks like before going down that route.
Yes this is probably better to wait for 0.15. I am not sure we could design something that would not end up hacky.
react-transform-catch-errors
only applies to user code - not modules.This means that when making errors inside a devcard while developing them, errors leak out.
I'm not sure yet whether this is only really a problem because it's in dev.
The component tree looks a bit like this:
But error transforms are only applied at the bottom.
I think it might be preferrable to redbox individual cards. Rather than using https://github.com/KeywordBrain/redbox-react - which takes over the whole page, I think we should only redbox up to the card boundary.