Explorar o código

fix redirect issue, caused by timing of events between angular location change and redux state changes

Torkel Ödegaard %!s(int64=7) %!d(string=hai) anos
pai
achega
e85a3f1d04
Modificáronse 1 ficheiros con 4 adicións e 3 borrados
  1. 4 3
      public/app/features/dashboard/dashboard_srv.ts

+ 4 - 3
public/app/features/dashboard/dashboard_srv.ts

@@ -77,6 +77,10 @@ export class DashboardSrv {
   postSave(clone, data) {
     this.dash.version = data.version;
 
+    // important that these happens before location redirect below
+    this.$rootScope.appEvent('dashboard-saved', this.dash);
+    this.$rootScope.appEvent('alert-success', ['Dashboard saved']);
+
     const newUrl = locationUtil.stripBaseFromUrl(data.url);
     const currentPath = this.$location.path();
 
@@ -84,9 +88,6 @@ export class DashboardSrv {
       this.$location.url(newUrl).replace();
     }
 
-    this.$rootScope.appEvent('dashboard-saved', this.dash);
-    this.$rootScope.appEvent('alert-success', ['Dashboard saved']);
-
     return this.dash;
   }