瀏覽代碼

fix: Make sure we dont add &autofitpanels to the url if it already exists #15849

Johannes Schill 6 年之前
父節點
當前提交
f3dbdfac07
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      public/app/core/services/keybindingSrv.ts

+ 4 - 1
public/app/core/services/keybindingSrv.ts

@@ -4,6 +4,7 @@ import _ from 'lodash';
 import coreModule from 'app/core/core_module';
 import appEvents from 'app/core/app_events';
 import { getExploreUrl } from 'app/core/utils/explore';
+import { store } from 'app/store/store';
 
 import Mousetrap from 'mousetrap';
 import 'mousetrap-global-bind';
@@ -294,7 +295,9 @@ export class KeybindingSrv {
     //Autofit panels
     this.bind('d a', () => {
       // this has to be a full page reload
-      window.location.href = window.location.href + '&autofitpanels';
+      const queryParams = store.getState().location.query;
+      const newUrlParam = queryParams.autofitpanels ? '' : '&autofitpanels';
+      window.location.href = window.location.href + newUrlParam;
     });
   }
 }