From 0f970a63ccaa8fb785989a2e61629a244996d718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Poizat?= Date: Fri, 20 Dec 2024 15:26:00 +0100 Subject: [PATCH] feat: Setup why-did-you-render Setup was removed by mistake during the split with cozy-drive. --- src/photos/targets/browser/index.jsx | 4 ++++ src/photos/targets/browser/wdyr.js | 8 ++++++++ 2 files changed, 12 insertions(+) create mode 100644 src/photos/targets/browser/wdyr.js diff --git a/src/photos/targets/browser/index.jsx b/src/photos/targets/browser/index.jsx index 841fabaf3..90013ff8c 100755 --- a/src/photos/targets/browser/index.jsx +++ b/src/photos/targets/browser/index.jsx @@ -7,6 +7,10 @@ import 'cozy-sharing/dist/stylesheet.css' import 'cozy-viewer/dist/stylesheet.css' import 'photos/styles/main.styl' +// Uncomment to activate why-did-you-render +// https://github.com/welldone-software/why-did-you-render +// import './wdyr' + import React from 'react' import { render } from 'react-dom' import { Provider } from 'react-redux' diff --git a/src/photos/targets/browser/wdyr.js b/src/photos/targets/browser/wdyr.js new file mode 100644 index 000000000..9c364d549 --- /dev/null +++ b/src/photos/targets/browser/wdyr.js @@ -0,0 +1,8 @@ +import React from 'react' + +if (process.env.NODE_ENV === 'development') { + const whyDidYouRender = require('@welldone-software/why-did-you-render') + whyDidYouRender(React, { + trackAllPureComponents: true + }) +}