瀏覽代碼

Fix sync issues when going from details to list

When going from migration details page to migrations list page, the
migrations list page would briefly display an older status of the
migration from the details page.
Sergiu Miclea 7 年之前
父節點
當前提交
0dd36f58e1
共有 2 個文件被更改,包括 8 次插入 和 2 次删除
  1. 4 1
      src/stores/MigrationStore.js
  2. 4 1
      src/stores/ReplicaStore.js

+ 4 - 1
src/stores/MigrationStore.js

@@ -84,7 +84,10 @@ class MigrationStore {
 
     try {
       let migration = await MigrationSource.getMigration(migrationId, options && options.skipLog)
-      runInAction(() => { this.migrationDetails = migration })
+      runInAction(() => {
+        this.migrationDetails = migration
+        this.migrations = this.migrations.map(m => m.id === migration.id ? migration : m)
+      })
     } finally {
       runInAction(() => { this.detailsLoading = false })
     }

+ 4 - 1
src/stores/ReplicaStore.js

@@ -105,7 +105,10 @@ class ReplicaStore {
 
     try {
       let replica = await ReplicaSource.getReplica(replicaId, options && options.skipLog)
-      runInAction(() => { this.replicaDetails = replica })
+      runInAction(() => {
+        this.replicaDetails = replica
+        this.replicas = this.replicas.map(r => r.id === replica.id ? replica : r)
+      })
     } finally {
       runInAction(() => { this.detailsLoading = false })
     }