Skip to content

Commit

Permalink
Bug 1908442 - call close method for Custom Job Action/Custom Push Act…
Browse files Browse the repository at this point in the history
…ion modal in callback of setState

This is a regression from the upgrade to React 18. 'setState' (to set it from
triggering state to non-triggering state) is asynchronous and the method in
which it gets set calls this.close() itself. Put that call as callback of
these setState calls.
  • Loading branch information
Archaeopteryx committed Jul 26, 2024
1 parent ae088bf commit c1cf6a6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ui/job-view/CustomJobActions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class CustomJobActions extends React.PureComponent {
currentRepo,
}).then(
(taskId) => {
this.setState({ triggering: false });
this.setState({ triggering: false }, this.close);
let message = 'Custom action request sent successfully:';
let url = tcLibUrls.ui(
checkRootUrl(currentRepo.tc_root_url),
Expand All @@ -175,8 +175,7 @@ class CustomJobActions extends React.PureComponent {
},
(e) => {
notify(formatTaskclusterError(e), 'danger', { sticky: true });
this.setState({ triggering: false });
this.close();
this.setState({ triggering: false }, this.close);
},
);
};
Expand Down

0 comments on commit c1cf6a6

Please sign in to comment.