Dashboard: Fix issue where out-of-view shared query panels caused blank dependent panels (#83966)
This commit is contained in:
@@ -74,6 +74,8 @@ function setupTestContext(options: Partial<Props>) {
|
|||||||
</Provider>
|
</Provider>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Needed so mocks work
|
||||||
|
props.panel.refreshWhenInView = false;
|
||||||
return { rerender, props, subject, store };
|
return { rerender, props, subject, store };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -384,11 +384,22 @@ export class DashboardModel implements TimeModel {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const panel of this.panels) {
|
const panelsToRefresh = this.panels.filter(
|
||||||
if (!this.otherPanelInFullscreen(panel) && (event.refreshAll || event.panelIds.includes(panel.id))) {
|
(panel) => !this.otherPanelInFullscreen(panel) && (event.refreshAll || event.panelIds.includes(panel.id))
|
||||||
panel.refresh();
|
);
|
||||||
|
|
||||||
|
// We have to mark every panel as refreshWhenInView /before/ we actually refresh any
|
||||||
|
// in case there is a shared query, as otherwise that might refresh before the source panel is
|
||||||
|
// marked for refresh, preventing the panel from updating
|
||||||
|
if (!this.isSnapshot()) {
|
||||||
|
for (const panel of panelsToRefresh) {
|
||||||
|
panel.refreshWhenInView = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const panel of panelsToRefresh) {
|
||||||
|
panel.refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ export class PanelModel implements DataConfigSource, IPanelModel {
|
|||||||
cacheTimeout?: string | null;
|
cacheTimeout?: string | null;
|
||||||
queryCachingTTL?: number | null;
|
queryCachingTTL?: number | null;
|
||||||
isNew?: boolean;
|
isNew?: boolean;
|
||||||
refreshWhenInView = false;
|
refreshWhenInView = true;
|
||||||
|
|
||||||
cachedPluginOptions: Record<string, PanelOptionsCache> = {};
|
cachedPluginOptions: Record<string, PanelOptionsCache> = {};
|
||||||
legend?: { show: boolean; sort?: string; sortDesc?: boolean };
|
legend?: { show: boolean; sort?: string; sortDesc?: boolean };
|
||||||
|
|||||||
Reference in New Issue
Block a user