diff --git a/package-lock.json b/package-lock.json index b0a4c0ba..31149265 100644 --- a/package-lock.json +++ b/package-lock.json @@ -158,6 +158,7 @@ "@types/superagent": "^8.1.9", "@types/xml2js": "^0.4.11", "@vitejs/plugin-react": "^6.0.1", + "@welldone-software/why-did-you-render": "^10.0.1", "ansi-to-react": "^6.2.6", "autoprefixer": "^10.4.27", "chai": "^4.3.6", @@ -6726,6 +6727,19 @@ "dev": true, "license": "MIT" }, + "node_modules/@welldone-software/why-did-you-render": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@welldone-software/why-did-you-render/-/why-did-you-render-10.0.1.tgz", + "integrity": "sha512-tMgGkt30iVYeLMUKExNmtm019QgyjLtA7lwB0QAizYNEuihlCG2eoAWBBaz/bDeI7LeqAJ9msC6hY3vX+JB97g==", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash": "^4" + }, + "peerDependencies": { + "react": "^19" + } + }, "node_modules/@xhayper/discord-rpc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@xhayper/discord-rpc/-/discord-rpc-1.3.0.tgz", diff --git a/package.json b/package.json index be6de4c3..5698e592 100644 --- a/package.json +++ b/package.json @@ -197,6 +197,7 @@ "@types/superagent": "^8.1.9", "@types/xml2js": "^0.4.11", "@vitejs/plugin-react": "^6.0.1", + "@welldone-software/why-did-you-render": "^10.0.1", "ansi-to-react": "^6.2.6", "autoprefixer": "^10.4.27", "chai": "^4.3.6", diff --git a/src/client/index-next.tsx b/src/client/index-next.tsx index 265ad109..cde9e722 100644 --- a/src/client/index-next.tsx +++ b/src/client/index-next.tsx @@ -1,3 +1,4 @@ +//import './wdyr.js'; import React from 'react'; import ReactDOM from 'react-dom/client'; import App from './AppNext.js'; diff --git a/src/client/wdyr.tsx b/src/client/wdyr.tsx new file mode 100644 index 00000000..331ba83d --- /dev/null +++ b/src/client/wdyr.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import whyDidYouRender from '@welldone-software/why-did-you-render'; + +if (process.env.NODE_ENV === 'development') { + console.log('init wdyr') + whyDidYouRender(React, { + include: [/ActivityDetails|ActivityCollapsible/], + exclude: [/^BrowserRouter/, /^Link/, /^Route/], + // collapseGroups: false, + // trackHooks: true, + trackAllPureComponents: false, + // logOnDifferentValues: true, + }); +} \ No newline at end of file