diff --git a/public/app/features/dashboard/state/DashboardModel.repeat.test.ts b/public/app/features/dashboard/state/DashboardModel.repeat.test.ts index 92ab69d029a..e393b98d8eb 100644 --- a/public/app/features/dashboard/state/DashboardModel.repeat.test.ts +++ b/public/app/features/dashboard/state/DashboardModel.repeat.test.ts @@ -587,6 +587,14 @@ describe('given dashboard with row and panel repeat', () => { expect(panelTypes).toEqual(['row', 'graph', 'graph', 'row', 'graph', 'graph']); }); + it('Row repeat should create new panel keys every repeat cycle', () => { + // This is the first repeated panel inside the second repeated row + // Since we create a new panel model every time (and new panel events bus) we need to create a new key here to trigger a re-mount & re-subscribe + const key1 = dashboard.panels[3].key; + dashboard.processRepeats(); + expect(key1).not.toEqual(dashboard.panels[3].key); + }); + it('should clean up old repeated panels', () => { dashboardJSON.panels = [ { diff --git a/public/app/features/dashboard/state/DashboardModel.ts b/public/app/features/dashboard/state/DashboardModel.ts index 17106080bba..1b74ac55d93 100644 --- a/public/app/features/dashboard/state/DashboardModel.ts +++ b/public/app/features/dashboard/state/DashboardModel.ts @@ -799,7 +799,6 @@ export class DashboardModel implements TimeModel { updateRepeatedPanelIds(panel: PanelModel, repeatedByRow?: boolean) { panel.repeatPanelId = panel.id; panel.id = this.getNextPanelId(); - panel.key = `${panel.id}`; panel.repeatIteration = this.iteration; if (repeatedByRow) { panel.repeatedByRow = true;