Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scenes: Set correct default options on plugin load #834

Closed

Conversation

mdvictor
Copy link
Contributor

Adds a new state flag to allow getting default options after plugin type change.

Fixes grafana/grafana#89836

@@ -180,7 +181,7 @@ export class VizPanel<TOptions = {}, TFieldConfig extends {} = {}> extends Scene
plugin,
currentOptions: panel.options,
currentFieldConfig: panel.fieldConfig,
isAfterPluginChange: false,
isAfterPluginChange: this.state.isAfterPluginChange ?? false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative to this is tackling it from the VizPanel.

The problem is when we create a VizPanel, if a VizPanel is created it cannot be after a plugin change. If the VizPanel needs to know when the plugin changes, my approach would be to implement in the VizPanel a method to change the plugin that manages all the logic when the plugin changes in the VizPanel.

All this logic is nowadays managed by VizPanelManager but I'd have it in the VizPanel instead.

@mdvictor mdvictor closed this Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scenes: Thresholds doesn't work after creating a gauge panel
2 participants