ovidiuch / react-component-playground

Minimal frame for loading and testing React components in isolation.
MIT License
76 stars 16 forks source link

Handle bad components #36

Open RaitoBezarius opened 8 years ago

RaitoBezarius commented 8 years ago

Sometimes, you have a bad component which will throw an exception at render.

It seems like that once they throw, you cannot remount any component after it due to the unmountComponent which will itself throw for internalInstance._currentElement (undefined on internalInstance).

I don't really know how we could implement this, maybe by wrapping the render method like react-transform-catch-errors does it.

(I wonder if this should be there or in the Cosmos suite, I believe that it's kind of low-level so it should be for react-component-playground, right?).

ovidiuch commented 8 years ago

Cosmos latest already embraces this, and the 0.14 boilerplate features react-transform-catch-errors integration. Did you try/use that boilerplate?

RaitoBezarius commented 8 years ago

I think that I'm pretty sure I'm using react-transform-catch-errors on my playground configuration, but I admit that I could have got something wrong during the process.

Will double-check!

But nevertheless, why integrating at Cosmos level?

Thanks!