ctrlplusb / react-async-component

Resolve components asynchronously, with support for code splitting and advanced server side rendering use cases.
MIT License
1.45k stars 62 forks source link

App hides some errors #25

Closed newsiberian closed 7 years ago

newsiberian commented 7 years ago

Hi,

I'm build a route with with asyncComponent and got an unrelated error, but then component wrapped with asyncComponent, there is no any errors in browser console, just clean screen. I can catch it only via React dev tool: cryptit_155

but, if I use component without wrapping in asyncComponent, then I got an error in browser console, like this: cryptit_156

kennethtruong commented 7 years ago

+1 Yea I also just noticed that my errors were swallowed so we don't know where the error is coming from

kennethtruong commented 7 years ago

I made a repo of what the issue. I've been using your boilerplate (Love it btw! Appreciate all the work you've been doing). https://github.com/kennethtruong/react-universally/blob/master/src/shared/components/DemoApp/Home/Home.js#L6 Usually if the error isn't swallowed by the catch in https://github.com/ctrlplusb/react-async-component/blob/master/src/asyncComponent.js#L134 It would say Uncaught (in promise) TypeError: Cannot read property 'error' of null at Line 12 of HomeRoute.js. But right now it just throws an Error somewhere in the React components rendering stack and it'll be hard to trace where the issue came from. I'm not too familiar with the reasoning with catching the error instead of letting it propagate but maybe you can log the error?

ctrlplusb commented 7 years ago

Sorry chaps, this was a total messup by me. I accidentally commented out the respective logging section. Fix will be released today.

kennethtruong commented 7 years ago

I did notice that theres a check for node for logging but will your fix account for when SSR is disabled?

ctrlplusb commented 7 years ago

Yep, already added || env === 'browser'

Thanks for following up :)

kennethtruong commented 7 years ago

Oh great! Thanks for the quick responses!

ctrlplusb commented 7 years ago

No problem :)

I have just released a new package. I also noticed my react-async-bootstrapper / react-tree-walker were swallowing errors, so I have updated them accordingly too.

scf4 commented 7 years ago

Hey guys, for me it swallows errors with TypeError: null is not an object (evaluating 'oldNode.parentNode.replaceChild'). Is this related/expected behaviour or not?