mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 04:04:00 -06:00
Dashboard: Fix issue where out-of-view shared query panels caused blank dependent panels (#83966)
This commit is contained in:
parent
dd01743de7
commit
d8b8a2c2b0
@ -74,6 +74,8 @@ function setupTestContext(options: Partial<Props>) {
|
||||
</Provider>
|
||||
);
|
||||
|
||||
// Needed so mocks work
|
||||
props.panel.refreshWhenInView = false;
|
||||
return { rerender, props, subject, store };
|
||||
}
|
||||
|
||||
|
@ -384,11 +384,22 @@ export class DashboardModel implements TimeModel {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const panel of this.panels) {
|
||||
if (!this.otherPanelInFullscreen(panel) && (event.refreshAll || event.panelIds.includes(panel.id))) {
|
||||
panel.refresh();
|
||||
const panelsToRefresh = this.panels.filter(
|
||||
(panel) => !this.otherPanelInFullscreen(panel) && (event.refreshAll || event.panelIds.includes(panel.id))
|
||||
);
|
||||
|
||||
// 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() {
|
||||
|
@ -205,7 +205,7 @@ export class PanelModel implements DataConfigSource, IPanelModel {
|
||||
cacheTimeout?: string | null;
|
||||
queryCachingTTL?: number | null;
|
||||
isNew?: boolean;
|
||||
refreshWhenInView = false;
|
||||
refreshWhenInView = true;
|
||||
|
||||
cachedPluginOptions: Record<string, PanelOptionsCache> = {};
|
||||
legend?: { show: boolean; sort?: string; sortDesc?: boolean };
|
||||
|
Loading…
Reference in New Issue
Block a user