osmandapp / OsmAnd

OsmAnd
https://osmand.net
Other
4.65k stars 1.02k forks source link

OsmAnd deletes favorites if one is saved before all favorites are loaded #20957

Open burillo-se opened 2 weeks ago

burillo-se commented 2 weeks ago

Description

If OsmAnd hasn't loaded its favorites yet, and I create a new one, the old ones are deleted and there appears to be no way to restore them.

(apologies, there was a rant previously, but backups work, it was user error)

Steps to reproduce

  1. Have lots of favorites
  2. Open OsmAnd app (the favorites will not be loaded until some time later - maybe this is specific to having favorite on SD card)
  3. Save a favorite

Actual result

All old favorites are deleted

Expected result

If favorites are unavailable right now, I'd expect either that I wouldn't be able to save a new one, or, preferably, it'll be saved and then added to favorites later.

Your Environment (required)

WARNING Crash-Logs MAY contain information you deem sensitive. Review this CAREFULLY before posting your issue!

OsmAnd Version: plus, 4.8.6
Android/iOS version: 12
Device model: Nokia 8.3
Crash-Logs: ?
yuriiurshuliak commented 2 weeks ago

Unfortunately, I do not fully understand the steps for reproduction. Am I correct in assuming that after opening the app with a large number of favorites, it takes some time for the favorites to load, and during that period, a new favorite needs to be created?

Could you please provide a video and more detailed steps to help us reproduce the bug accurately without making assumptions?

anatolyburakov commented 2 weeks ago

Yes, your understanding is correct: when I first open OsmAnd, I have no favorites, but they appear after a while (usually about a minute in). During that period, if I save a favorite, all previous favorites that I had get deleted. I'm not sure if this is specific to having OsmAnd data stored on SD card (as opposed to in main memory) or if it is even related to having lots of favorites (as opposed to some other issue that prevents favorites from loading quickly), but I'm mentioning it just in case it is relevant.

Here's a link to GDrive with a video showing the period between loading OsmAnd and appearance of favoties: https://drive.google.com/file/d/1Csb3Km9FxkvviNMIlo267PhGXu_I7dem/view

If I save a favorite during this period, other favorites are deleted (as in, even after waiting for a few minutes, the only favorites I will see is the one I just created, and if I reload OsmAnd I will see the same - just one favorite).

yuriiurshuliak commented 2 weeks ago

The bug has been successfully reproduced. To reproduce it, import a large number of favorites, fully close the application, then reopen it and go to My Places > Favorites. You’ll notice that not all the favorites load right after opening the app. Close the My Places tab, create a new favorite on the map, and close the app again. Upon reopening and navigating back to My Places > Favorites, only the newly created favorite will appear, while the previously imported favorites will no longer be visible.

OsmAnd~ 4.9.0#3340m, released: 2024-10-02

vshcherb commented 2 weeks ago

Just FYI: It's possible to use backups for favorites from local storage, to restore missing favorites

anatolyburakov commented 2 weeks ago

Just FYI: It's possible to use backups for favorites from local storage, to restore missing favorites

yep, I eventually found where they were. the process could've been less manual, but that's a separate issue.

sonora commented 1 week ago

From my testing, the behavior even seems somehow triggered by going to the My Favorites screen too soon after app start:

So while the 10 seconds may vary with your number of favorites, it seems the issue is aggravated or even created by going to some screen too early in the process, creating this extra-long blocking.

I believe I have seen similar effects by trying certain search operations too early after app start. For example, if going to Search > Address, and tapping "Search city/location first": If you do this before the list of "Nearest cities" is displayed at the bottom of the screen, you increase the overall time for the search to return results significantly vs. first waiting for the Nearest cities to be displayed.