diff --git a/public/app/features/dashboard-scene/panel-edit/PanelDataPane/PanelDataQueriesTab.tsx b/public/app/features/dashboard-scene/panel-edit/PanelDataPane/PanelDataQueriesTab.tsx index d93ab989105..3d8b2369158 100644 --- a/public/app/features/dashboard-scene/panel-edit/PanelDataPane/PanelDataQueriesTab.tsx +++ b/public/app/features/dashboard-scene/panel-edit/PanelDataPane/PanelDataQueriesTab.tsx @@ -48,13 +48,6 @@ export class PanelDataQueriesTab extends SceneObjectBase deactivate(); } buildQueryOptions(): QueryGroupOptions { diff --git a/public/app/features/dashboard-scene/panel-edit/VizPanelManager.tsx b/public/app/features/dashboard-scene/panel-edit/VizPanelManager.tsx index ed43cefb919..eae39a8c39d 100644 --- a/public/app/features/dashboard-scene/panel-edit/VizPanelManager.tsx +++ b/public/app/features/dashboard-scene/panel-edit/VizPanelManager.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React from 'react'; +import React, { useEffect } from 'react'; import { DataSourceApi, @@ -467,10 +467,19 @@ export class VizPanelManager extends SceneObjectBase { public static Component = ({ model }: SceneComponentProps) => { const { panel, tableView } = model.useState(); const styles = useStyles2(getStyles); - const panelToShow = tableView ?? panel; + const dataProvider = panelToShow.state.$data; - return
{}
; + // This is to preserve SceneQueryRunner stays alive when switching between visualizations and table view + useEffect(() => { + return dataProvider?.activate(); + }, [dataProvider]); + + return ( + <> +
{}
+ + ); }; }