iann0036 / former2

Generate CloudFormation / Terraform / Troposphere templates from your existing AWS resources.
https://former2.com
MIT License
2.2k stars 267 forks source link

App crashes when devtools are open and react-devtools extension is installed in chrome #361

Open ojkelly opened 6 months ago

ojkelly commented 6 months ago

Hey @iann0036 👋

When the react-devtools extensions is installed in Chrome is emits an event to start a connection with the react-devtools that may be embedded in an app running on the page, when you open chromes dev tools.

Ideally we would just disable the extension on all pages but the ones we need it on.

Screenshot 2024-03-17 at 16 14 48

The bug may be caused by other extensions too, because the contents of message.data could be anything from any other extension, like the JS Object from react-devtools.

A simple fix is probably just a try..catch where you ignore the exceptions. Effectively whats happening now without the app crashing.

https://github.com/iann0036/former2/blob/c3923971dc22d4aed0ab10e8ed171356e05e87df/js/app.js#L1400-L1415

iann0036 commented 6 months ago

Hey @ojkelly,

Thanks for the heads up!

I'll throw away parsing errors as you've suggested. I believe I technically could verify the sending extension, but as soo many users like to build their own customised version - this is probably the best path forward.