WebCloud/react-error-guard

Doesn't work, I got blank page

dehghani-mehdi opened this issue · 6 comments

Hi,

I tired to replace react-error-guard with default react ErrorBoundary, but it doesn't show anything when error happens. (ErrorBoundary works as expected btw)

I also got this in browser console:

React will try to recreate this component tree from scratch using the error boundary you provided, ErrorBoundaryComponent.

I use:

  • React v16.5.0
  • Webpack v4.18.0

Would you help me on this?

Sure, can you provide some code snippets?

@WebCloud Thanks for the reply, actually I tired to add react-error-guard to my existing (big) project, but it doesn't work, that's why I created this issue.
But with simple hello world react app react-error-guard works well.

Any idea why it doesn't work with my main project?

Well, without no code snippet I can give you a checklist of things to look for:

  • the error boundary component has to be within the subtree of the component who crashed (in case you don't wrap the whole app in just one.
  • if the error thrown is caught it won't show the error component
  • if you cause a re-render/refresh somehow after the component crashed it could also prevent the error message to be rendered.

Also, does this happens both with the Production and Developer error boundary components?

I will try your checklist. thanks for that.

Also, does this happens both with the Production and Developer error boundary components?

I didn't test, I'll and report the result.

I have very simple react starter kit and by "simple hello world react app" I mean this starter kit.
Actually I used this for my main project too and that's why I have no idea why your plugin doesn't work in it.

I found out what was wrong, it was my configuration not your plugin. sorry about that.