DashboardGridItem: Trigger row repeat behaviour on panel edit complete (#110397)

reset SceneGridRow repeats on panel change
This commit is contained in:
Sergej-Vlasov
2025-09-02 17:10:10 +03:00
committed by GitHub
parent 2a7fcd7d5f
commit d5eb3e291a
2 changed files with 12 additions and 0 deletions
@@ -12,6 +12,7 @@ import {
MultiValueVariable,
CustomVariable,
VariableValueSingle,
SceneGridRow,
} from '@grafana/scenes';
import { GRID_COLUMN_COUNT } from 'app/core/constants';
import { OptionsPaneCategoryDescriptor } from 'app/features/dashboard/components/PanelEditor/OptionsPaneCategoryDescriptor';
@@ -24,6 +25,7 @@ import { DashboardLayoutItem } from '../types/DashboardLayoutItem';
import { getDashboardGridItemOptions } from './DashboardGridItemEditor';
import { DashboardGridItemRenderer } from './DashboardGridItemRenderer';
import { DashboardGridItemVariableDependencyHandler } from './DashboardGridItemVariableDependencyHandler';
import { RowRepeaterBehavior } from './RowRepeaterBehavior';
export interface DashboardGridItemState extends SceneGridItemStateLike {
body: VizPanel;
@@ -121,6 +123,12 @@ export class DashboardGridItem
public editingCompleted(withChanges: boolean) {
if (withChanges) {
this._prevRepeatValues = undefined;
if (this.parent instanceof SceneGridRow) {
const repeater = this.parent.state.$behaviors?.find((b) => b instanceof RowRepeaterBehavior);
if (repeater) {
repeater.resetPrevRepeatValues();
}
}
}
if (this.state.variableName && this.state.repeatDirection === 'h' && this.state.width !== GRID_COLUMN_COUNT) {
@@ -183,6 +183,10 @@ export class RowRepeaterBehavior extends SceneObjectBase<RowRepeaterBehaviorStat
// Remove behavior and the scoped local variable
row.setState({ $behaviors: row.state.$behaviors!.filter((b) => b !== this), $variables: undefined });
}
public resetPrevRepeatValues() {
this._prevRepeatValues = undefined;
}
}
function getRowContentHeight(panels: SceneGridItemLike[]): number {