Explorar el Código

Fix reset 'welcome' state when having received a disconnect while on it

Lennart Grahl hace 7 años
padre
commit
453b82d8ea
Se han modificado 1 ficheros con 11 adiciones y 0 borrados
  1. 11 0
      src/services/webclient.ts

+ 11 - 0
src/services/webclient.ts

@@ -2189,12 +2189,23 @@ export class WebClientService {
         }
         }
 
 
         // Stop and show an alert on the welcome page
         // Stop and show an alert on the welcome page
+        const isWelcome = this.$state.includes('welcome');
         this.stop({
         this.stop({
             reason: reason,
             reason: reason,
             send: false,
             send: false,
             // TODO: Use welcome.{reason} once we have it
             // TODO: Use welcome.{reason} once we have it
             close: 'welcome',
             close: 'welcome',
         });
         });
+
+        // Note: This is required to reset the mode and potentially
+        //       re-establish a connection if needed.
+        // TODO: Remove once we have created pages for each mode on the
+        //       'welcome' page.
+        if (isWelcome) {
+            this.$state.reload().catch((error) => {
+                this.$log.error('Unable to reload state:', error);
+            });
+        }
         this.showAlert(alertMessage);
         this.showAlert(alertMessage);
     }
     }