Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop working after "RemoveLayer(Marker)" #59

Open
markus-renezeder opened this issue Mar 28, 2021 · 0 comments
Open

Stop working after "RemoveLayer(Marker)" #59

markus-renezeder opened this issue Mar 28, 2021 · 0 comments

Comments

@markus-renezeder
Copy link

Hello and thank you very much for sharing your code with us!

I was working with an "older" version of your code and it was working fine. After I found the possibility to use the map bounds in the current version, I updated the code. After the update the application stops working if I remove a marker from the map (the Blazor app stops, the map is still working).

You can reproduce it with your sample application by trying to draw a shape.

I did a little bit of research and restored the async function from the older version in LeafletInterop.cs which works for me.

//public static void RemoveLayer(IJSRuntime jsRuntime, string mapId, string layerId)
//{
//	jsRuntime.InvokeVoidAsync($"{_BaseObjectContainer}.removeLayer", mapId, layerId).GetAwaiter().GetResult();
//	DisposeLayerReference(layerId);
//}

public static async ValueTask RemoveLayer(IJSRuntime jsRuntime, string mapId, string layerId)
{
	await jsRuntime.InvokeVoidAsync($"{_BaseObjectContainer}.removeLayer", mapId, layerId);
	DisposeLayerReference(layerId);
}

I'm using .NET Core 5, Blazor Server Side.

BR Markus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant