Dashboard: Fix for change detector in dashboards with live refresh (#108903)
This commit is contained in:
@@ -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')) {
|
||||
|
||||
Reference in New Issue
Block a user