Skip to content

Commit

Permalink
fix: re-render plugin when props change
Browse files Browse the repository at this point in the history
This fixes the issue with the visualization type not changing when using
the View as options in dashboard item context menu.
  • Loading branch information
edoardo committed Mar 5, 2024
1 parent ce717fa commit 1c76a2a
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -27,6 +27,8 @@ const VisualizationPluginWrapper = (props) => {
[pluginProps]
)

useEffect(() => setPluginProps(props), [props])

const onLoadingComplete = () => setIsLoading(false)

return (
Expand Down

0 comments on commit 1c76a2a

Please sign in to comment.