Closed Bug 1480166 Opened 6 years ago Closed 6 years ago

Use class fields for event handlers to avoid function.bind(this) calls

Categories

(Tree Management :: Treeherder: Frontend, enhancement, P2)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: camd, Assigned: camd)

References

Details

Attachments

(5 files)

In many cases, I had to bind functions to ``this`` in ``componentDidMount`` and even once in the ``render`` function to get the binding to work. We SHOULD only need to make those calls in the constructor. I can't prove this, but I feel that it is a side-effect of us being a hybrid angular/react app while we are transitioning. So once we are a completely ReactJS app, we should move those ``bind`` calls to the constructor of the components.
Priority: -- → P2
We can also try using class properties, once we're on Neutrino 9: https://reactjs.org/docs/handling-events.html (search the page for "If you are using the experimental public class fields syntax")
Depends on: 1364894
Summary: Move function.bind(this) calls to component constructors when no longer using react2angular → Use class fields for event handlers to avoid function.bind(this) calls
Commit pushed to master at https://github.com/mozilla/treeherder https://github.com/mozilla/treeherder/commit/8dab49d9eb8ff4dcae59926613faedd543356624 Bug 1480166 - Use class fields to avoid bind() calls in job-view root (#4317)
Commit pushed to master at https://github.com/mozilla/treeherder https://github.com/mozilla/treeherder/commit/42a827cc6ee92b669496131c2bab99353444bfa5 Bug 1480166 - Use class fields to avoid bind() calls in /details (#4345) Also remove AutoclassifyTab dead code
Commit pushed to master at https://github.com/mozilla/treeherder https://github.com/mozilla/treeherder/commit/aefabbbda55e3351f0ca8fb037bce907e63c871f Bug 1480166 - Use class fields to avoid bind() calls in App and /headerbars (#4355) * Make handleUrlChanges function name consistent
Assignee: nobody → cdawson
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: