rungwiroon/BlazorGoogleMaps

Marker : GetLabel when label is string throws error

HiZackDavid opened this issue · 2 comments

Problem 1

Steps to reproduce :
1- Run ClientSideDemoNet7
2- Go to "Google map markers"
3- Open browser inspector
4- Add a marker
5- Click on the marker

Result :
TypeError: Cannot read properties of undefined (reading 'stop')
Marker click bug

Problem 2

Steps to reproduce :
1- Run ClientSideDemoNet7
2- Go to "Google map markers"
3- Open browser inspector
4- Add two markers

Result :
Throws an error : "Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: 'T' is an invalid start of a value. [...]"
Marker add bug

Note :
This exception is triggered only for every pair marker added. For example, if we add 1 marker, the exception will appear for the second marker added. We can add a third marker and the exception won't appear, but as soon as we add a 4th marker, the exception is triggered again. So on and so forth.

Problem 3

Similar to problem 1, in my own project I have an error whenever I try to clear all the markers in the map. Here is what my function to clear map looks like

private async Task RemoveAllMarkers()
{
    while (this.markers.Any())
    {
        var marker = this.markers.Pop();
        await marker.SetMap(null);
    }

    this.deviceMarkers = Enumerable.Empty<Device>();

    if (this.markerClustering is not null)
    {
        await this.markerClustering.ClearMarkers();
    }
}

The errors are as follows :
"TypeError: Cannot read properties of undefined (reading 'setMap')"
"TypeError: Cannot read properties of undefined (reading 'clearMarkers')"

I got error when trying to get marker label. So strange since it looks like i should had failed long time ago for someone.
Please review latest package. Also one problem one issue in github!
https://www.nuget.org/packages/BlazorGoogleMaps/3.2.5

I got error when trying to get marker label. So strange since it looks like i should had failed long time ago for someone. Please review latest package. Also one problem one issue in github! https://www.nuget.org/packages/BlazorGoogleMaps/3.2.5

Problem 2 seems to have been solved by the recent commit

I will create other issues for the 2 other problems for good practice.