From c5672806cb1c7f6c5a31ece0807e47097d7b7543 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 1 Jul 2021 15:48:10 -0500 Subject: [PATCH] Add "Why Did You Render" for debugging --- app/soapbox/main.js | 1 + app/soapbox/wdyr.js | 6 ++++++ package.json | 1 + yarn.lock | 12 ++++++++++++ 4 files changed, 20 insertions(+) create mode 100644 app/soapbox/wdyr.js diff --git a/app/soapbox/main.js b/app/soapbox/main.js index 9480a1ea4..8ba4b044e 100644 --- a/app/soapbox/main.js +++ b/app/soapbox/main.js @@ -1,5 +1,6 @@ 'use strict'; +import './wdyr'; import * as registerPushNotifications from './actions/push_notifications'; import { default as Soapbox, store } from './containers/soapbox'; import React from 'react'; diff --git a/app/soapbox/wdyr.js b/app/soapbox/wdyr.js new file mode 100644 index 000000000..978e5f116 --- /dev/null +++ b/app/soapbox/wdyr.js @@ -0,0 +1,6 @@ +import React from 'react'; + +if (process.env.NODE_ENV === 'development') { + const whyDidYouRender = require('@welldone-software/why-did-you-render'); + whyDidYouRender(React); +} diff --git a/package.json b/package.json index 6d5053cf0..55749e31d 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "@babel/preset-react": "^7.0.0", "@babel/runtime": "^7.3.4", "@popperjs/core": "^2.4.4", + "@welldone-software/why-did-you-render": "^6.2.0", "array-includes": "^3.0.3", "autoprefixer": "^10.0.0", "axios": "^0.21.0", diff --git a/yarn.lock b/yarn.lock index 64ed758b1..967d0bc3b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2135,6 +2135,13 @@ "@webassemblyjs/wast-parser" "1.8.5" "@xtuc/long" "4.2.2" +"@welldone-software/why-did-you-render@^6.2.0": + version "6.2.0" + resolved "https://registry.yarnpkg.com/@welldone-software/why-did-you-render/-/why-did-you-render-6.2.0.tgz#a053e63f45adb57161c723dee4b005769ea1b64f" + integrity sha512-ViwaE09Vgb0yXzyZuGTWCmWy/nBRAEGyztMdFYuxIgmL8yoXX5TVMCfieiJGdRQQPiDUznlYmcu0lu8kN1lwtQ== + 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" @@ -7768,6 +7775,11 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= +lodash@^4: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + lodash@^4.0.1: version "4.17.19" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"