gaearon / react-hot-loader

Tweak React components in real time. (Deprecated: use Fast Refresh instead.)
http://gaearon.github.io/react-hot-loader/
MIT License
12.26k stars 801 forks source link

Stop errors from reloading the page? #18

Closed syranide closed 10 years ago

syranide commented 10 years ago

Personally I would prefer (if it is possible) if run-time errors during hot replacement would not reload the page, allowing me to fix any silly mistake and keep my state. If I modify the code enough that it's broken, it's easy enough to just reload manually.

gaearon commented 10 years ago

@syranide

This is how it works if you set notify=errors or notify=all (e.g. react-hot?notify=all). It will then dump errors in console and desktop Notification API (I'm open to adding notify=console and making it default though).

What do you think?

syranide commented 10 years ago

Oh, had missed that :+1:

Personally I'm not really interested in desktop notifications (I keep the console open all the time) and wouldn't mind notify=console, not that I really care (just click "deny"). The biggest reason I can see for it are other users viewing the dev site, they aren't really interested in desktop notifications for errors.

PS. Feel free to close this.

gaearon commented 10 years ago

I think notify=console would be really useful for default behavior so I'll leave this open for now.

syranide commented 10 years ago

Using notify= on browsers without the notification API causes tons of 'Notification' is undefined error spam.

gaearon commented 10 years ago

I suppose we'd need to add a typeof Notification !== 'undefined' check in requestPermission and showNotification. Would you like to submit a PR for this?

syranide commented 10 years ago

I could look into it if you want.

gaearon commented 10 years ago

Would be nice, I'm currently busy with normalizr :-)

gaearon commented 10 years ago

Thank you!

syranide commented 10 years ago

Any time! This is awesome (I'll try to spread the word on IRC whenever I can :)).