apexcharts / Blazor-ApexCharts

A blazor wrapper for ApexCharts.js
https://apexcharts.github.io/Blazor-ApexCharts
MIT License
788 stars 91 forks source link

Calling NavigationManager.Refresh breaks Toolbar and Tooltips UI in .NET 8 Blazor Server. #489

Open melittleman opened 1 month ago

melittleman commented 1 month ago

Hi there, firstly thank you for making such a great library! It really has made working with the charts so much easier in a .NET ecosystem.

We have come across a probably very niche issue where calling the NavigationManager.Refresh() method seems to break the UI of the charts, specifically the Toolbar and Tooltip components from what we can see.

We are using the NavigationManager.Refresh() call to update components once HttpContext information has changed e.g. 'dark mode' state being stored in a Cookie, or page / offset information being stored in the URL so it would be great if the chart component could simply hold it's state (I did try to use 'data-permanent' or provide an @key attribute with no luck).

Failing that I think having to manually call ApexChart.RenderAsync() would be perfectly acceptable, however when I tried this in an overridden OnAfterRenderAsync it worked initially but then reverted to the broken UI after the Task had completed.

Please see the attached .NET 8 Blazor Server Web App project that reproduces this issue. Simply click the 'Refresh' button on the Home page. Please let me know if there's any more information needed or if in fact I'm just doing something stupid!

ApexChartsTesting.zip

Thanks, Matt