-
Couldn't load subscription status.
- Fork 14
Description
I'm a newbie so please excuse any mistakes I have made by submitting this issue. I have not used Slack before, and I was unable to join the group there. My email address is mark@markevans.org if anyone needs to add me first.
I have found that the example file ClusterAggregates.razor often fails. It's inconsistent. The map always loads. But sometimes the bubble layer loads and sometimes it doesn't. When it fails, I get the following JS error:
atlas.min.js:55 Error: layers.75e0ea40-700e-4382-9741-5b7027861563: source "2671a15c-0192-4d19-b5e6-bdffc9c45ef8" not found
at Object.Rn [as emitValidationErrors] (atlas.min.js:56:9835)
at pt (atlas.min.js:56:355799)
at mt._validate (atlas.min.js:56:375637)
at mt.addLayer (atlas.min.js:56:367199)
at t.addLayer (atlas.min.js:105:172826)
at fN._addMapboxLayers (atlas.min.js:105:1048190)
I have also found that adding the following delay fixes the problem:
public async Task OnMapReady(MapEventArgs eventArgs)
{
await eventArgs.Map.AddPopupAsync(_popup);
_datasource = new AzureMapsControl.Components.Data.DataSource
{
EventActivationFlags = AzureMapsControl.Components.Data.DataSourceEventActivationFlags.None(),
Options = new()
{
Cluster = true,
ClusterRadius = 50,
ClusterProperties = new Dictionary<string, AzureMapsControl.Components.Atlas.Expression>(_entityTypes.Select(entityType => BuildClusterProperty(entityType)))
}
};
await Task.Delay(100); // ############# map often fails without this delay ###############
await eventArgs.Map.AddSourceAsync(_datasource);
}
I'm wondering if there is a better way to avoid this issue?
To Reproduce
- Create a new Blazor Web app.
- Add all the nuget packages, links to js files, appconfig.json stuff, AuthService.cs, data file etc.
- Copy/paste ClusterAggregates.razor to your project.
- Run
Expected behavior
Load the bubble layer every time rather than just some of the time.
Desktop (please complete the following information):
- OS: Windows 11
- Browser Edge
- VS 2022, .net 8.