From 1c76a2aa73f2616768a82974d20fb17fe79b2d0d Mon Sep 17 00:00:00 2001 From: Edoardo Sabadelli Date: Tue, 5 Mar 2024 10:49:14 +0100 Subject: [PATCH] fix: re-render plugin when props change This fixes the issue with the visualization type not changing when using the View as options in dashboard item context menu. --- .../VisualizationPlugin/VisualizationPluginWrapper.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/VisualizationPlugin/VisualizationPluginWrapper.js b/src/components/VisualizationPlugin/VisualizationPluginWrapper.js index 96503b4f8d..891ff36d8e 100644 --- a/src/components/VisualizationPlugin/VisualizationPluginWrapper.js +++ b/src/components/VisualizationPlugin/VisualizationPluginWrapper.js @@ -1,5 +1,5 @@ import { CenteredContent, CircularLoader, Layer } from '@dhis2/ui' -import React, { useCallback, useState } from 'react' +import React, { useCallback, useEffect, useState } from 'react' import { VisualizationPlugin } from '../VisualizationPlugin/VisualizationPlugin.js' // handle internal state for features that need to work without the app's Redux store @@ -27,6 +27,8 @@ const VisualizationPluginWrapper = (props) => { [pluginProps] ) + useEffect(() => setPluginProps(props), [props]) + const onLoadingComplete = () => setIsLoading(false) return (