Closed Bug 1393515 Opened 6 years ago Closed 5 years ago

Create a mixin to show exactly which properties should be added to shouldComponentUpdate()


(DevTools :: General, enhancement, P2)



(firefox57 fix-optional)

Tracking Status
firefox57 --- fix-optional


(Reporter: miker, Assigned: miker)


(Blocks 1 open bug)



(2 files)

We should create a new mixin that can be used to identify exactly which properties should be added to shouldComponentUpdate() as this will greatly simplify the development process.

Output should be a complete shouldComponentUpdate function e.g.

shouldComponentUpdate(nextProps, nextState) {
  return this.props.depth !== nextProps.depth ||
         this.props.focused !== nextProps.focused;

Of course, to get all of the props we will need to do everything that can be done with the component but this would save a *lot* of time when optimizing the React components.
We can't auto-generate shouldComponentUpdate() because of the many object types we have but we can show exactly which properties have changed for a particular component.
Comment on attachment 8907696 [details]
Bug 1393515 - Create mixin to show which props should be added to shouldComponentUpdate()

looks good. What is the process for turning this on? Do i need to know about the pref? Will this be needed if we upgrade react and can use react.pref?
For the moment we have decided to stick with using perf.html and React 16's excellent markers. If we decide to use HOCs we can always reopen this bug.
Has Regression Range: --- → irrelevant
Has STR: --- → irrelevant
Closed: 5 years ago
OS: Unspecified → All
Hardware: Unspecified → All
Resolution: --- → WONTFIX
Attachment #8907696 - Flags: review?(jlaster)
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.