diff --git a/packages/concordia-app/package.json b/packages/concordia-app/package.json index 7574568..afb2d22 100644 --- a/packages/concordia-app/package.json +++ b/packages/concordia-app/package.json @@ -27,6 +27,7 @@ "@ezerous/breeze": "~0.3.0", "@ezerous/drizzle": "~0.4.0", "@reduxjs/toolkit": "~1.4.0", + "@welldone-software/why-did-you-render": "^6.0.0-rc.1", "concordia-contracts": "~0.1.0", "i18next": "^19.8.3", "i18next-browser-languagedetector": "^6.0.1", diff --git a/packages/concordia-app/src/index.jsx b/packages/concordia-app/src/index.jsx index 6974fbf..536fd4c 100644 --- a/packages/concordia-app/src/index.jsx +++ b/packages/concordia-app/src/index.jsx @@ -1,3 +1,4 @@ +import './utils/wdyr'; import React, { Suspense } from 'react'; import { render } from 'react-dom'; import { Drizzle } from '@ezerous/drizzle'; diff --git a/packages/concordia-app/src/utils/wdyr.js b/packages/concordia-app/src/utils/wdyr.js new file mode 100644 index 0000000..5849fb8 --- /dev/null +++ b/packages/concordia-app/src/utils/wdyr.js @@ -0,0 +1,13 @@ +import React from 'react'; +import whyDidYouRender from '@welldone-software/why-did-you-render'; +import * as ReactRedux from 'react-redux/lib'; + +if (process.env.NODE_ENV === 'development') { + whyDidYouRender(React, { + trackHooks: true, + trackExtraHooks: [ + [ReactRedux, 'useSelector'], + ], + trackAllPureComponents: true, + }); +} diff --git a/yarn.lock b/yarn.lock index 9c80d91..1a2a1ea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2685,6 +2685,13 @@ "@webassemblyjs/wast-parser" "1.8.5" "@xtuc/long" "4.2.2" +"@welldone-software/why-did-you-render@^6.0.0-rc.1": + version "6.0.0-rc.1" + resolved "https://registry.yarnpkg.com/@welldone-software/why-did-you-render/-/why-did-you-render-6.0.0-rc.1.tgz#b0e92edb2e34e7af695cca1822844f02018d9814" + integrity sha512-qQe5w89tYnYtwRqlhdF33ivWjsQlGXkan5lFzNwpAoMEUFIbDuwvFiBUAbE76Lfz63GabSaf1vyuCusgJ7Rtqg== + dependencies: + lodash "^4" + "@xtuc/ieee754@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" @@ -11378,7 +11385,7 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -"lodash@>=3.5 <5", lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.5: +"lodash@>=3.5 <5", lodash@^4, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.5: version "4.17.20" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==