refactor react-router related code of what happens when run details closes so the back/forward browser buttons behave naturally
@@ -64,8 +64,6 @@ class RunDetails extends Component {
componentWillMount() {
this._fetchRun(this.props);
- this.opener = locationService.previous;
- this.initialHistoryLength = history.length;
}
componentWillReceiveProps(nextProps) {
@@ -137,15 +135,7 @@ class RunDetails extends Component {
afterClose = () => {
const { router, params } = this.context;
- if (this.opener) {
- // step back in the history to the item that's prior to initial load of RunDetails
- const offsetToInitialRoute = this.initialHistoryLength - history.length;
- router.go(offsetToInitialRoute - 1);
- } else {
- // back to the 'Activity' tab (using 'replace' to discard history item for RunDetails)
- const fallbackUrl = buildPipelineUrl(params.organization, params.pipeline);
- router.replace(fallbackUrl);
- }
+ router.push(buildPipelineUrl(params.organization, params.pipeline));
};
render() {
