From 42ee81a97c7185bd7d4594fce3dedbe682a06fd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 14 Dec 2018 10:47:18 +0100 Subject: [PATCH] fixed issue with switching panels --- public/app/core/components/Form/Input.tsx | 4 ++++ .../features/dashboard/dashgrid/DashboardPanel.tsx | 13 +++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/public/app/core/components/Form/Input.tsx b/public/app/core/components/Form/Input.tsx index f69aac9759f..83a77fdb38c 100644 --- a/public/app/core/components/Form/Input.tsx +++ b/public/app/core/components/Form/Input.tsx @@ -31,6 +31,10 @@ interface Props extends React.HTMLProps { } export class Input extends PureComponent { + static defaultProps = { + className: '', + }; + state = { error: null, }; diff --git a/public/app/features/dashboard/dashgrid/DashboardPanel.tsx b/public/app/features/dashboard/dashgrid/DashboardPanel.tsx index 5744031b719..6ee83d6e5b9 100644 --- a/public/app/features/dashboard/dashgrid/DashboardPanel.tsx +++ b/public/app/features/dashboard/dashgrid/DashboardPanel.tsx @@ -81,10 +81,10 @@ export class DashboardPanel extends PureComponent { } if (plugin.exports) { - this.setState({ plugin: plugin }); + this.setState({ plugin: plugin, angularPanel: null }); } else { 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 { this.setState({ angularPanel }); } - cleanUpAngularPanel(unmounted?: boolean) { + cleanUpAngularPanel() { if (this.state.angularPanel) { this.state.angularPanel.destroy(); - - if (!unmounted) { - this.setState({ angularPanel: null }); - } + this.element = null; } } componentWillUnmount() { - this.cleanUpAngularPanel(true); + this.cleanUpAngularPanel(); } onMouseEnter = () => {