Skip to content

Commit 0217375

Browse files
authored
Fix the 'setUser is not a function' error when loading /intermittent-failures/bugdetails. (#8941)
1 parent 969e391 commit 0217375

File tree

3 files changed

+34
-6
lines changed

3 files changed

+34
-6
lines changed

ui/intermittent-failures/App.jsx

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ class IntermittentFailuresApp extends React.Component {
3030
this.setState(state);
3131
};
3232

33+
setUser = (user) => {
34+
this.setState({ user });
35+
};
36+
37+
notify = (message) => {
38+
this.setState({ errorMessages: [message] });
39+
};
40+
3341
render() {
3442
const { user, graphData, tableData, errorMessages } = this.state;
3543
const { path } = this.props.match;
@@ -51,10 +59,8 @@ class IntermittentFailuresApp extends React.Component {
5159
mainTableData={tableData}
5260
updateAppState={this.updateAppState}
5361
user={user}
54-
setUser={(user) => this.setState({ user })}
55-
notify={(message) =>
56-
this.setState({ errorMessages: [message] })
57-
}
62+
setUser={this.setUser}
63+
notify={this.notify}
5864
/>
5965
)}
6066
/>
@@ -66,16 +72,33 @@ class IntermittentFailuresApp extends React.Component {
6672
mainGraphData={graphData}
6773
mainTableData={tableData}
6874
updateAppState={this.updateAppState}
75+
user={user}
76+
setUser={this.setUser}
77+
notify={this.notify}
6978
/>
7079
)}
7180
/>
7281
<Route
7382
path={`${path}/bugdetails`}
74-
render={(props) => <BugDetailsView {...props} />}
83+
render={(props) => (
84+
<BugDetailsView
85+
{...props}
86+
user={user}
87+
setUser={this.setUser}
88+
notify={this.notify}
89+
/>
90+
)}
7591
/>
7692
<Route
7793
path={`${path}/bugdetails?startday=:startday&endday=:endday&tree=:tree&failurehash=:failurehash&bug=bug`}
78-
render={(props) => <BugDetailsView {...props} />}
94+
render={(props) => (
95+
<BugDetailsView
96+
{...props}
97+
user={user}
98+
setUser={this.setUser}
99+
notify={this.notify}
100+
/>
101+
)}
79102
/>
80103
<Redirect from={`${path}/`} to={`${path}/main`} />
81104
</Switch>

ui/intermittent-failures/BugDetailsView.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,9 @@ BugDetailsView.propTypes = {
371371
}),
372372
),
373373
}),
374+
user: PropTypes.shape({}),
375+
setUser: PropTypes.func.isRequired,
376+
notify: PropTypes.func.isRequired,
374377
};
375378

376379
BugDetailsView.defaultProps = {

ui/intermittent-failures/MainView.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,8 @@ MainView.propTypes = {
405405
tableData: PropTypes.arrayOf(PropTypes.shape({})),
406406
graphData: PropTypes.arrayOf(PropTypes.shape({})),
407407
initialParamsSet: PropTypes.bool.isRequired,
408+
user: PropTypes.shape({}),
409+
setUser: PropTypes.func.isRequired,
408410
notify: PropTypes.func.isRequired,
409411
};
410412

0 commit comments

Comments
 (0)