Dashboard: Fix for change detector in dashboards with live refresh (#108903)

This commit is contained in:
Bogdan Matei
2025-08-01 13:38:11 +03:00
committed by GitHub
parent bfa6bb0264
commit f3cd54769c
@@ -46,20 +46,24 @@ export class DashboardSceneChangeTracker {
}
static isUpdatingPersistedState({ payload }: SceneObjectStateChangedEvent) {
const partialUpdateKeys = Object.keys(payload.partialUpdate);
// If there are no changes in the state, the check is not needed
if (Object.keys(payload.partialUpdate).length === 0) {
if (partialUpdateKeys.length === 0) {
return false;
}
// Any change in the panel should trigger a change detection
// Any change in the grid item should trigger a change detection
// The PanelTimeRange includes the overrides configuration
if (
payload.changedObject instanceof VizPanel ||
payload.changedObject instanceof DashboardGridItem ||
payload.changedObject instanceof PanelTimeRange
) {
if (payload.changedObject instanceof DashboardGridItem || payload.changedObject instanceof PanelTimeRange) {
return true;
}
// Panels contain a _renderCounter state prop which should not be marked as a change
if (payload.changedObject instanceof VizPanel) {
if (partialUpdateKeys.length > 1 || partialUpdateKeys[0] !== '_renderCounter') {
return true;
}
}
// SceneQueryRunner includes the DS configuration
if (payload.changedObject instanceof SceneQueryRunner) {
if (!Object.prototype.hasOwnProperty.call(payload.partialUpdate, 'data')) {