diff --git a/public/app/plugins/panel/graph/graph.ts b/public/app/plugins/panel/graph/graph.ts index 819fa92e37d..eccc354ac75 100644 --- a/public/app/plugins/panel/graph/graph.ts +++ b/public/app/plugins/panel/graph/graph.ts @@ -136,9 +136,14 @@ class GraphElement { if (!this.panel.legend.show) { if (this.legendElem.hasChildNodes()) { - this.legendElemRoot.unmount(); + this.legendElemRoot.render(null); } - this.renderPanel(); + // we need to wait for react to finish rendering the legend before we can render the graph + // this is a slightly worse version of the `renderCallback` logic we use below + // the problem here is there's nothing to pass a `renderCallback` to since we don't want to render the legend at all. + setTimeout(() => { + this.renderPanel(); + }); return; }