Browse Source

ref(js): Make SidebarPanelStore useLegacyStore compatible (#29268)

Evan Purkhiser 3 years ago
parent
commit
837cb8e4de
1 changed files with 10 additions and 3 deletions
  1. 10 3
      static/app/stores/sidebarPanelStore.tsx

+ 10 - 3
static/app/stores/sidebarPanelStore.tsx

@@ -1,11 +1,14 @@
 import Reflux from 'reflux';
 import Reflux from 'reflux';
 
 
+import SidebarPanelActions from 'app/actions/sidebarPanelActions';
 import {SidebarPanelKey} from 'app/components/sidebar/types';
 import {SidebarPanelKey} from 'app/components/sidebar/types';
 
 
-import SidebarPanelActions from '../actions/sidebarPanelActions';
+import {CommonStoreInterface} from './types';
 
 
-type SidebarPanelStoreInterface = {
-  activePanel: SidebarPanelKey | '';
+type ActivePanelType = SidebarPanelKey | '';
+
+type SidebarPanelStoreInterface = CommonStoreInterface<ActivePanelType> & {
+  activePanel: ActivePanelType;
 
 
   onActivatePanel(panel: SidebarPanelKey): void;
   onActivatePanel(panel: SidebarPanelKey): void;
   onTogglePanel(panel: SidebarPanelKey): void;
   onTogglePanel(panel: SidebarPanelKey): void;
@@ -38,6 +41,10 @@ const storeConfig: Reflux.StoreDefinition & SidebarPanelStoreInterface = {
     this.activePanel = '';
     this.activePanel = '';
     this.trigger(this.activePanel);
     this.trigger(this.activePanel);
   },
   },
+
+  getState() {
+    return this.activePanel;
+  },
 };
 };
 
 
 /**
 /**