VladislavAntonyuk / MauiSamples

.NET MAUI Samples
https://vladislavantonyuk.azurewebsites.net/articles?categoryName=.NET%20MAUI/Xamarin
MIT License
723 stars 186 forks source link

Stuck in infinite loop navigating back to page with map #432

Closed LeoJHarris closed 3 months ago

LeoJHarris commented 3 months ago

Hi @VladislavAntonyuk, first off excellent work on putting these samples together, I've found an issue that maybe my error but not sure, that is on loading my map page for the first time it works fine, on navigating away and back again it seems to get stuck in loop

First time page loads correctly showing 523 pins which there are

image

On navigating away and returning to the page it seems to be adding individually and taking very long to do time to do so, also markers is showing 4178 items which the max should only be 523 items, page gets stuck at this point

image

LeoJHarris commented 3 months ago

I've updated my code on how the pins get added using ObservableCollection with replace range and not getting stuck in the loop but its not pins showing on returning to the page.

StoreLocatorMapTabViewModel.CustomStorePins.ReplaceRange

Update

Found that on returning to the the collection view still holds the pins so checking if pins has any before ReplacingRange, seems to be working for now.