mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PanelState: Introduce a new separate redux panel state not keyed by panel.id (#40302)
* Initial pass to move panel state to it's own, and make it by key not panel.id * Progress * Not making much progress, having panel.key be mutable is causing a lot of issues * Think this is starting to work * Began fixing tests * Add selector * Bug fixes and changes to cleanup, and fixing all flicking when switching library panels * Removed console.log * fixes after merge * fixing tests * fixing tests * Added new test for changePlugin thunk
This commit is contained in:
@@ -179,7 +179,7 @@ export class DashboardGrid extends PureComponent<Props, State> {
|
||||
isViewing={panel.isViewing}
|
||||
>
|
||||
{(width: number, height: number) => {
|
||||
return this.renderPanel(panel, width, height, panel.key);
|
||||
return this.renderPanel(panel, width, height);
|
||||
}}
|
||||
</GrafanaGridItem>
|
||||
);
|
||||
@@ -188,18 +188,19 @@ export class DashboardGrid extends PureComponent<Props, State> {
|
||||
return panelElements;
|
||||
}
|
||||
|
||||
renderPanel(panel: PanelModel, width: any, height: any, itemKey: string) {
|
||||
renderPanel(panel: PanelModel, width: any, height: any) {
|
||||
if (panel.type === 'row') {
|
||||
return <DashboardRow key={itemKey} panel={panel} dashboard={this.props.dashboard} />;
|
||||
return <DashboardRow key={panel.key} panel={panel} dashboard={this.props.dashboard} />;
|
||||
}
|
||||
|
||||
if (panel.type === 'add-panel') {
|
||||
return <AddPanelWidget key={itemKey} panel={panel} dashboard={this.props.dashboard} />;
|
||||
return <AddPanelWidget key={panel.key} panel={panel} dashboard={this.props.dashboard} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<DashboardPanel
|
||||
key={itemKey}
|
||||
key={panel.key}
|
||||
stateKey={panel.key}
|
||||
panel={panel}
|
||||
dashboard={this.props.dashboard}
|
||||
isEditing={panel.isEditing}
|
||||
|
||||
Reference in New Issue
Block a user