[v11.0.x] DashboardScene: Fixes issue with editing panels that uses instanceState (#86824)
DashboardScene: Fixes issue with editing panels that uses instanceState (#86687)
* DashboardScene: Fixes issue with editing panels that uses instanceState
* Minor tweak
* Update
* Update
(cherry picked from commit b28e6bc5d8)
This commit is contained in:
+1
-1
@@ -253,7 +253,7 @@
|
||||
"@grafana/prometheus": "workspace:*",
|
||||
"@grafana/runtime": "workspace:*",
|
||||
"@grafana/saga-icons": "workspace:*",
|
||||
"@grafana/scenes": "^4.6.0",
|
||||
"@grafana/scenes": "^4.12.0",
|
||||
"@grafana/schema": "workspace:*",
|
||||
"@grafana/sql": "workspace:*",
|
||||
"@grafana/ui": "workspace:*",
|
||||
|
||||
@@ -23,7 +23,7 @@ interface Props {
|
||||
export const PanelOptions = React.memo<Props>(({ vizManager, searchQuery, listMode, data }) => {
|
||||
const { panel, sourcePanel, repeat } = vizManager.useState();
|
||||
const parent = sourcePanel.resolve().parent;
|
||||
const { options, fieldConfig } = panel.useState();
|
||||
const { options, fieldConfig, _pluginInstanceState } = panel.useState();
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
const panelFrameOptions = useMemo(
|
||||
@@ -42,10 +42,10 @@ export const PanelOptions = React.memo<Props>(({ vizManager, searchQuery, listMo
|
||||
data,
|
||||
plugin: plugin,
|
||||
eventBus: panel.getPanelContext().eventBus,
|
||||
instanceState: panel.getPanelContext().instanceState!,
|
||||
instanceState: _pluginInstanceState,
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [panel, options, fieldConfig]);
|
||||
}, [panel, options, fieldConfig, _pluginInstanceState]);
|
||||
|
||||
const libraryPanelOptions = useMemo(() => {
|
||||
if (parent instanceof LibraryVizPanel) {
|
||||
|
||||
@@ -121,11 +121,6 @@ export function setDashboardPanelContext(vizPanel: VizPanel, context: PanelConte
|
||||
//return onUpdatePanelSnapshotData(this.props.panel, frames);
|
||||
return Promise.resolve(true);
|
||||
};
|
||||
|
||||
// Backward compatibility with id
|
||||
context.instanceState = {
|
||||
legacyPanelId: getPanelIdForVizPanel(vizPanel),
|
||||
};
|
||||
}
|
||||
|
||||
function getBuiltInAnnotationsLayer(scene: DashboardScene): dataLayers.AnnotationsDataLayer | undefined {
|
||||
|
||||
Reference in New Issue
Block a user