diff --git a/src/components/Item/VisualizationItem/Item.js b/src/components/Item/VisualizationItem/Item.js index 68e2d85a1..55d16dba8 100644 --- a/src/components/Item/VisualizationItem/Item.js +++ b/src/components/Item/VisualizationItem/Item.js @@ -64,6 +64,19 @@ class Item extends Component { } async componentDidMount() { + // Avoid refetching the visualization already in the Redux store + // when the same dashboard item is added again. + // This also solves a flashing of all the "duplicated" dashboard items. + !this.props.visualization.id && + this.props.setVisualization( + await apiFetchVisualization(this.props.item) + ) + + // force fetch when recording to allow caching of the visualizations request + if (this.props.isRecording) { + apiFetchVisualization(this.props.item) + } + try { // Avoid refetching the visualization already in the Redux store // when the same dashboard item is added again.