highcharts-react icon indicating copy to clipboard operation
highcharts-react copied to clipboard

Changing 'constructorType' from 'chart' to 'mapChart' does not work

Open eqqe opened this issue 3 years ago • 1 comments

When changing dynamically 'constructorType' from 'chart' to 'mapChart', the chart is not re-rendered correctly.

A workaround is to add key={constructorType} in

<HighchartsReact
        highcharts={Highcharts}
        options={chartOptions}
        constructorType={constructorType}
        key={constructorType}
      />

to force the rerender when the constructorType changes.

A full example is available here: https://stackblitz.com/edit/react-tpdcvy?file=index.js

Try to remove the key={constructorType} and click the button, the map is not rendered.

eqqe avatar Apr 19 '22 09:04 eqqe

Hi @eqqe,

Thank you for reporting!

This problem is a bug and needs to be handled in the wrapper code. Your workaround is really good, a fix will work very similar.

ppotaczek avatar Apr 20 '22 07:04 ppotaczek