Просмотр исходного кода

Merge pull request #40 from smiclea/CORWEB-66

Fix execution selection after deletion CORWEB-66
Alessandro Pilotti 8 лет назад
Родитель
Сommit
a8d015fe21
1 измененных файлов с 6 добавлено и 4 удалено
  1. 6 4
      src/components/ReplicaExecutions/ReplicaExecutions.js

+ 6 - 4
src/components/ReplicaExecutions/ReplicaExecutions.js

@@ -123,10 +123,12 @@ class ReplicaExecutions extends Component {
           let index = this.props.replica.executions.indexOf(this.state.executionRef)
 
           MigrationActions.deleteReplicaExecution(this.props.replica, this.state.executionRef.id, () => {
-            if (this.props.replica.executions[index - 1]) {
-              this.changeExecution(this.props.replica.executions[index - 1])
-            } else if (this.props.replica.executions[index + 1]) {
-              this.changeExecution(this.props.replica.executions[index + 1])
+            let executions = this.props.replica.executions
+
+            if (executions[index]) {
+              this.changeExecution(executions[index])
+            } else if (executions[index - 1]) {
+              this.changeExecution(executions[index - 1])
             } else {
               this.changeExecution(null)
             }