diff --git a/src/components/Item/VisualizationItem/Visualization/IframePlugin.js b/src/components/Item/VisualizationItem/Visualization/IframePlugin.js index f32d90767..bb7bc098b 100644 --- a/src/components/Item/VisualizationItem/Visualization/IframePlugin.js +++ b/src/components/Item/VisualizationItem/Visualization/IframePlugin.js @@ -159,6 +159,7 @@ const IframePlugin = ({ } } }, [ + error, recordOnNextLoad, pluginProps, iframeSrc, @@ -190,6 +191,7 @@ const IframePlugin = ({ }, [pluginType, dispatch, visualization, iframePluginStatus, isFirstOfType]) useEffect(() => { + prevPluginRef.current = undefined setError(null) }, [filterVersion, visualization.type]) diff --git a/src/components/Item/VisualizationItem/Visualization/Visualization.js b/src/components/Item/VisualizationItem/Visualization/Visualization.js index 33e5a6fb7..4beb64e67 100644 --- a/src/components/Item/VisualizationItem/Visualization/Visualization.js +++ b/src/components/Item/VisualizationItem/Visualization/Visualization.js @@ -4,7 +4,7 @@ import i18n from '@dhis2/d2-i18n' import { Button, Cover, IconInfo24, IconWarning24, colors } from '@dhis2/ui' import uniqueId from 'lodash/uniqueId.js' import PropTypes from 'prop-types' -import React, { useMemo } from 'react' +import React, { useCallback, useMemo } from 'react' import { useSelector } from 'react-redux' import { isLLVersionCompatible, @@ -73,14 +73,13 @@ const Visualization = ({ ) }, [visualization, activeType, originalType, itemFilters]) - const filterVersion = useMemo(() => uniqueId(), []) + const filterVersion = useCallback(() => uniqueId(), []) const iFramePluginProps = useMemo( () => ({ originalType, activeType, style, - filterVersion, dashboardMode, dashboardId, itemId: item.id, @@ -91,7 +90,6 @@ const Visualization = ({ originalType, activeType, style, - filterVersion, dashboardMode, dashboardId, item.id, @@ -140,6 +138,7 @@ const Visualization = ({ return ( ) @@ -213,7 +212,7 @@ const Visualization = ({ item={item} activeType={activeType} visualization={visualizationConfig} - filterVersion={filterVersion} + filterVersion={filterVersion()} style={style} gridWidth={gridWidth} {...rest}