Skip to content

Commit 87f144d

Browse files
committed
Move listener binding to lifecycle method
1 parent ac75121 commit 87f144d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/BranchMenu.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ export class BranchMenu extends React.Component<
7979
super(props);
8080

8181
const repo = this.props.model.pathRepository;
82-
this._addListeners();
8382

8483
this.state = {
8584
filter: '',
@@ -89,6 +88,13 @@ export class BranchMenu extends React.Component<
8988
};
9089
}
9190

91+
/**
92+
* Callback invoked immediately after mounting a component (i.e., inserting into a tree).
93+
*/
94+
componentDidMount(): void {
95+
this._addListeners();
96+
}
97+
9298
/**
9399
* Callback invoked when a component will no longer be mounted.
94100
*/

0 commit comments

Comments
 (0)