Просмотр исходного кода

fixed issue with switching panels

Torkel Ödegaard 7 лет назад
Родитель
Сommit
42ee81a97c

+ 4 - 0
public/app/core/components/Form/Input.tsx

@@ -31,6 +31,10 @@ interface Props extends React.HTMLProps<HTMLInputElement> {
 }
 }
 
 
 export class Input extends PureComponent<Props> {
 export class Input extends PureComponent<Props> {
+  static defaultProps = {
+    className: '',
+  };
+
   state = {
   state = {
     error: null,
     error: null,
   };
   };

+ 5 - 8
public/app/features/dashboard/dashgrid/DashboardPanel.tsx

@@ -81,10 +81,10 @@ export class DashboardPanel extends PureComponent<Props, State> {
       }
       }
 
 
       if (plugin.exports) {
       if (plugin.exports) {
-        this.setState({ plugin: plugin });
+        this.setState({ plugin: plugin, angularPanel: null });
       } else {
       } else {
         plugin.exports = await importPluginModule(plugin.module);
         plugin.exports = await importPluginModule(plugin.module);
-        this.setState({ plugin: plugin });
+        this.setState({ plugin: plugin, angularPanel: null });
       }
       }
     }
     }
   }
   }
@@ -106,18 +106,15 @@ export class DashboardPanel extends PureComponent<Props, State> {
     this.setState({ angularPanel });
     this.setState({ angularPanel });
   }
   }
 
 
-  cleanUpAngularPanel(unmounted?: boolean) {
+  cleanUpAngularPanel() {
     if (this.state.angularPanel) {
     if (this.state.angularPanel) {
       this.state.angularPanel.destroy();
       this.state.angularPanel.destroy();
-
-      if (!unmounted) {
-        this.setState({ angularPanel: null });
-      }
+      this.element = null;
     }
     }
   }
   }
 
 
   componentWillUnmount() {
   componentWillUnmount() {
-    this.cleanUpAngularPanel(true);
+    this.cleanUpAngularPanel();
   }
   }
 
 
   onMouseEnter = () => {
   onMouseEnter = () => {