-
-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add react-error-overlay
#484
Conversation
@Timer what a wonderful surprise! 😍 I have a few questions:
|
It is the expected but not the best behavior.
I'm not on the React team so take what I say with a grain of salt. IMO,
We can dual publish a CJS and ESM version (based on |
We should. |
Actually I think it's best not to hard reload in this case. The nice thing about Cosmos is that it keeps state outside of the user's render tree, so regardless of what crashes in the user code we can re-render from scratch after a HMR change and still preserve previous state. Even if it's Redux state, we create the store from scratch and flush all component instances on every render. It's a different take on hot reloading...
|
Totally your call. 😄 If you'd like, you can open another issue for support for something like dismiss-runtime-error that way it can be automatically closed. |
Sounds good, but we can definitely merge without that. If you're interested in finishing the remaining bits, there are four outstanding ESLint errors and 3-4 falling Jest tests—partly due to react-error-overlay ES syntax that Jest doesn't transform and thus understand, so best to tackle tests after facebook/create-react-app#3354 is resolved. Thanks again for your interest in this! |
I've rebased this so we don't fall behind -- did you want to tackle facebook/create-react-app#3354 or do you want me to take care of it? 😄 No rush. |
I'll take a stab at it 🔪 |
@Timer is there a reason for using Still it seems like the API changed a bit because I get this warning after upgrading:
|
Whoops, sorry! We just released I'll update this PR tonight and see where it puts us. Sorry for the run-around. |
I was eager to make the change but this is even better!
Excellent. Let me know if you run into any trouble. Besides the 3 falling tests I have one minor ask: Can you put the CRO logic inside a separate file to keep loader-entry clean? Like |
Thank you @Timer, this is a great improvement in Cosmos' DX! Quick question: Is there any difference/advantage in using |
@skidding in I'm not sure what happens with webpack's UMD build, but it's more future proof this way (we may ship two versions instead of UMD). So doing |
import getCosmosConfig from 'react-cosmos-config'; | ||
import extendWebpackConfig from './extend-webpack-config'; | ||
import getUserWebpackConfig from './user-webpack-config'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about this new line, I didn't notice it.
@Timer Got it. Thanks again! |
My pleasure! Let me know if you ever need help upgrading in the future. |
@Timer thinking of programmatically closing runtime error overlay in some cases. I noticed there's a |
Mainly because in our use case it doesn't make sense to dismiss. Happy to accept a pull request exporting it. |
I'm going to bed, but this should get you started.
If you'd like, you can tell me what adjustments to make and I'll see what I can do. 😄
I'm not familiar with
react-cosmos
, so I added build and runtime error reporting to where I felt it made most sense.http://g.recordit.co/LGb1qX9yJw.gif
Enables all
react-error-overlay
features: runtime errors, click-to-open source, and build time errors.