Repository navigation
Fix infinite locate spinner + cached last-known geolocation - #8
Merged
Merged
Conversation
Bug: getCurrentPosition callbacks never fire while a browser permission prompt sits undecided (no timeout applies), so the locate button could spin forever — e.g. pressing 'Find in this area', dismissing the prompt, then tapping locate. - getFreshPosition() wraps the two-step fix attempt with a hard 20s guard that always ends the spinner (single-settle protected) Feature: last-known-position cache (localStorage, 7d validity) - Every good fix is persisted; refs hydrate from it at boot so distances render immediately - locate() with a cache resolves INSTANTLY (map flies to the last position, no spinner) while a fresh fix updates the marker in the background; if the user moved > ~400m the map follows the fresh fix - Permission denied/unavailable now degrades gracefully to the cached position instead of an error-only dead end
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug (reported)
Pressing Find in this area, then the locate button → spinner rolls forever.
Root cause: while a browser permission prompt sits undecided,
getCurrentPositioncallbacks never fire — the specified timeout does not apply.locatingstayed true indefinitely.Fix + feature
getFreshPosition()wraps the two-step fix with a hard 20 s guard (single-settle protected) — the spinner always endsVerified with Playwright: permission-blocked context + cached position → instant fly to last position, spinner never sticks (0 after click, 0 after 4.5 s).