浏览代码

fix: fixed redirect after save, fixes #10946

Torkel Ödegaard 7 年之前
父节点
当前提交
2e9433c495
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      public/app/features/dashboard/dashboard_srv.ts

+ 5 - 2
public/app/features/dashboard/dashboard_srv.ts

@@ -77,8 +77,11 @@ export class DashboardSrv {
   postSave(clone, data) {
     this.dash.version = data.version;
 
-    if (data.url !== this.$location.path()) {
-      this.$location.url(locationUtil.stripBaseFromUrl(data.url)).replace();
+    const newUrl = locationUtil.stripBaseFromUrl(data.url);
+    const currentPath = this.$location.path();
+
+    if (newUrl !== currentPath) {
+      this.$location.url(newUrl).replace();
     }
 
     this.$rootScope.appEvent('dashboard-saved', this.dash);