-
Michelle Nguyen authored
Summary: Found this library awhile back that is supposed to help determine why a react component is re-rendering: https://github.com/welldone-software/why-did-you-render Didn't get a chance to try it out until now, and found it pretty helpful, so thought it was worthwhile to just include the setup for other people to use. It should only get imported in dev mode. We have too many components, so tracking the renders for all of them will just spam the console. instead, what you should do if you want to track the renders for a component is: - go to the file that the component is defined in. - if the component name is Autocomplete, add this line at the bottom of the page: `Autocomplete.whyDidYouRender = true`. - reload the page and interact with the component - look at the console for any renders Test Plan: tried it with one of my autocomplete components: {F92113} Here, I clearly need to memoize the function that's passed to my component, because it shouldn't be a reason for re-rendering Reviewers: zasgar, philkuz, nserrino, #engineering Reviewed By: zasgar, #engineering Differential Revision: https://phab.corp.pixielabs.ai/D5997 GitOrigin-RevId: 449f6e679db0f9862c195324801b601da3ff1f04
4f891498
Analyzing file…