Przeglądaj źródła

Merge pull request #203 from smiclea/list-loading

Fix list loading animation if list is empty
Dorin Paslaru 8 lat temu
rodzic
commit
37f60f4252
2 zmienionych plików z 8 dodań i 2 usunięć
  1. 4 1
      src/stores/MigrationStore.js
  2. 4 1
      src/stores/ReplicaStore.js

+ 4 - 1
src/stores/MigrationStore.js

@@ -28,8 +28,10 @@ class MigrationStore {
   @observable canceling: boolean | { failed: boolean } = true
   @observable detailsLoading: boolean = true
 
+  migrationsLoaded: boolean = false
+
   @action getMigrations(options?: { showLoading: boolean }) {
-    if ((options && options.showLoading) || this.migrations.length === 0) {
+    if ((options && options.showLoading) || !this.migrationsLoaded) {
       this.loading = true
     }
 
@@ -43,6 +45,7 @@ class MigrationStore {
         return migration
       })
       this.loading = false
+      this.migrationsLoaded = true
     }).catch(() => {
       this.loading = false
     })

+ 4 - 1
src/stores/ReplicaStore.js

@@ -45,10 +45,12 @@ class ReplicaStore {
   @observable backgroundLoading: boolean = false
   @observable detailsLoading: boolean = true
 
+  replicasLoaded: boolean = false
+
   @action getReplicas(options?: { showLoading: boolean }): Promise<void> {
     this.backgroundLoading = true
 
-    if ((options && options.showLoading) || this.replicas.length === 0) {
+    if ((options && options.showLoading) || !this.replicasLoaded) {
       this.loading = true
     }
 
@@ -56,6 +58,7 @@ class ReplicaStore {
       this.replicas = replicas
       this.loading = false
       this.backgroundLoading = false
+      this.replicasLoaded = true
     }).catch(() => {
       this.loading = false
       this.backgroundLoading = false