altibiz / ozds

OZDS
Other
0 stars 0 forks source link

Meter graph on mobile is bugged #52

Open GabrijelAB opened 1 month ago

GabrijelAB commented 1 month ago

Only on mobile chart is somehow null after no matter what or when and throws an error when you try to await chart.RenderAsync(); This is solved, but there is a lot of errors and task cancelation exceptions that still happon.

Reproduce: Go to a MeterDetailsTable, then go to MetersTable then back to MeterDetailsTable. Leave it for a few seconds or up to a minute, maybe refresh and the exception should happens. Either in MeterGauge or MeterGraph.

The errors are usually Task cancellation exception, and sometimes null reference but I think I fixed that so far.

GabrijelAB commented 1 month ago

Error: System.NullReferenceException: Object reference not set to an instance of an object. at ApexCharts.ApexChart1.RenderChartAsync() at ApexCharts.ApexChart1.RenderAsync() at Ozds.Client.Shared.MeterGraph.SetAnnotationGraphOptions() in C:\Users\Marko\ProjectsGH\ozds\src\Ozds.Client\Shared\MeterGraph.razor:line 415 at Ozds.Client.Shared.MeterGraph.GetValues(DateTimeOffset fromDate, DateTimeOffset toDate, Boolean reRenderChart) in C:\Users\Marko\ProjectsGH\ozds\src\Ozds.Client\Shared\MeterGraph.razor:line 347 at Ozds.Client.Shared.MeterGraph.DataMenuItemClicked(String type) in C:\Users\Marko\ProjectsGH\ozds\src\Ozds.Client\Shared\MeterGraph.razor:line 225 at Ozds.Client.Shared.MeterGraph.OnInitializedAsync() in C:\Users\Marko\ProjectsGH\ozds\src\Ozds.Client\Shared\MeterGraph.razor:line 190 at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

GabrijelAB commented 18 hours ago

Some issues are fixed. But the TaskCanceledException is still there and I have no idea what to do about it. The easyest way to recrate it is to go to MetersTable then wait for like 10 sec, refresh the page and then go to a different page. The issue is that the timers will still activate Elapsed methods and nothing I do ever dispose of them properly. Right now I just catch the exeption.