mirror of
https://github.com/grafana/grafana.git
synced 2026-09-05 04:40:13 -05:00
React: Add why-did-you-render dev extension to better see what components re-render and why (in console) (#23455)
* React: Add why-did-you-render dev extension to better understand what components re-renders * Lock version * Updated yarn locj
This commit is contained in:
+10
-8
@@ -1,9 +1,11 @@
|
||||
import app from './app';
|
||||
import React from 'react';
|
||||
|
||||
/*
|
||||
Import theme CSS based on env vars, e.g.: `env GRAFANA_THEME=light yarn start`
|
||||
*/
|
||||
declare var GRAFANA_THEME: any;
|
||||
require('../sass/grafana.' + GRAFANA_THEME + '.scss');
|
||||
|
||||
app.init();
|
||||
export function initDevFeatures() {
|
||||
// if why-render is in url enable why did you render react extension
|
||||
if (window.location.search.indexOf('why-render') !== -1) {
|
||||
const whyDidYouRender = require('@welldone-software/why-did-you-render');
|
||||
whyDidYouRender(React, {
|
||||
trackAllPureComponents: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user