Add React and Redux DevTools#6793
Conversation
ui/index.js
Outdated
There was a problem hiding this comment.
I think this should be behind some condition but I'm not sure what it is:
if (global.METAMASK_DEBUG) {
require('react-devtools')
}Here global.METAMASK_DEBUG is always falsy for some reason
There was a problem hiding this comment.
But maybe this doesn't matter as it's not a huge increase to our bundle?
There was a problem hiding this comment.
I think it should be excluded from production builds. It's big enough.
Using METAMASK_DEBUG like you suggested seems perfectly fine to me. Another option would be adding it to the entries array in the gulpfile. Using a conditional is probably simpler though - easier to ensure it's only included in the ui bundle this way.
There was a problem hiding this comment.
Ah sorry, I missed the part about it being undefined. That's because it should be process.env.METAMASK_DEBUG.
There was a problem hiding this comment.
Good catch, I was confused by the use of global. a few lines below (which only works because it's after require('./app/store/store') which sets it 🤦♂
|
|
I can confirm that this does still affect our bundle size. More detailed numbers:
|
|
I've just updated this branch to conditionally load devtools. It was a bit more challenging than I had expected - using |
I've updated the README with some new notes, see 19613ba |
|
Delighted to see this merged! 🎉 Definitely will make it easier to inspect what is going on and debug 👍 Might be worthwhile adding to the documentation that for Redux Devtools to work, the checkbox Was trying to figure out why I couldn't see anything and then eventually figured out I had to tick that option in the settings 😅 Granted it was my first time using it, so perhaps that's why I wasn't sure what to do. |
|
We ran into the same problem! 😅 |
|
@MarkOSullivan94 I've just put up a PR to improve the documentation: #6882 Feel free to take a look, and let us know if it could be improved further! Thanks for the feedback. |
Refs #5620 and #6455
This PR adds the React DevTools and Redux DevTools to the project. This allows us to more easily debug React components, their state and props, as well as the history of redux actions.
(New: there's now a single command,
npm run start:devthat'll run these concurrently. See 19613ba for context. The following instructions also work.)You can test this setup by:
$ npm start # And load the extension as you normally wouldAnd in another terminal:
And in another terminal:
Important pending tasks
global.METAMASK_DEBUGis always falsy?)Bundle size
npm startnpm run distScreenshots and videos
React DevTools:
Opening the Redux DevTools (first installing the extension):
Inspecting Redux state: