[v10.3.x] LibraryPanels: Fix issue with repeated library panels (#82259)

LibraryPanels: Fix issue with repeated library panels (#82255)

Fixes an issue where a library panel being repeated by a
template variable would briefly use the All value for the first
repeat instance

(cherry picked from commit 984d2da9ae)

Co-authored-by: kay delaney <45561153+kaydelaney@users.noreply.github.com>
This commit is contained in:
grafana-delivery-bot[bot]
2024-02-09 16:10:51 +02:00
committed by GitHub
co-authored by kay delaney
parent 4898cc1dac
commit 6d54337286
+3 -2
View File
@@ -147,15 +147,16 @@ export function loadLibraryPanelAndUpdate(panel: PanelModel): ThunkResult<void>
try {
const libPanel = await getLibraryPanel(uid, true);
panel.initLibraryPanel(libPanel);
await dispatch(initPanelState(panel));
const dashboard = getStore().dashboard.getModel();
const dashboard = getStore().dashboard.getModel();
if (panel.repeat && dashboard) {
const panelIndex = dashboard.panels.findIndex((p) => p.id === panel.id);
dashboard.repeatPanel(panel, panelIndex);
dashboard.sortPanelsByGridPos();
dashboard.events.publish(new DashboardPanelsChangedEvent());
}
await dispatch(initPanelState(panel));
} catch (ex) {
console.log('ERROR: ', ex);
dispatch(