(data)
| 115 | } |
| 116 | |
| 117 | function componentRerenders(data) { |
| 118 | printLine('heading', 'Component Re-rendering'); |
| 119 | |
| 120 | if (data.rerenders.length > 1) { |
| 121 | printLine('fail', 'There are components that are potentially re-rendering unnecessarily. Below are identified events that triggered them:'); |
| 122 | log(''); |
| 123 | // print eventTypes, eventNames, and components rerendered for each unnecessary rerendering |
| 124 | for (let i = 1; i < data.rerenders.length; i += 1) { |
| 125 | if ((data.rerenders[i].components).length > 0) { |
| 126 | log(indentD + chalk.underline(data.rerenders[i].type + ' - ' + data.rerenders[i].name) + ' => ' + data.rerenders[i].components); |
| 127 | } |
| 128 | } |
| 129 | log(''); |
| 130 | // print suggestions for possible improvements |
| 131 | log(chalk.italic('Possible improvements to re-rendering')); |
| 132 | log(''); |
| 133 | printLine('suggestion', indent + "* " + "Consider utilizing shouldComponentDidUpdate of components that shouldn't be constantly re-rendering"); |
| 134 | printLine('suggestion', indent + "* " + "Note: this may affect functionality of child components"); |
| 135 | } else { |
| 136 | printLine('pass', indent + 'Way to go, Idaho! No unnecessary re-rendering of components were detected.'); |
| 137 | log(''); |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | Object.defineProperty(exports, '__esModule', { |
| 142 | value: true |
nothing calls this directly
no test coverage detected