Restore last viewport on launch; skip auto-fly when restored#7
Merged
Conversation
Persist the map center+zoom (debounced) on each region change via a small viewport store backed by the same EncryptedStorage we use for auth. On launch, hydrate the saved viewport and use it as the camera's initialViewState so elements fetch immediately for that region instead of going through a zoom-1 world view and the fly-to-user dance. When a saved viewport exists, the recenter button is the user's way to jump to their current location; we no longer auto-fly there on first position fix. First-launch users (no saved viewport) still get the fly to user behavior so they don't open the app to a blank world. The off-center check now also runs from a useMemo so the recenter button can appear as soon as position arrives, even if the user hasn't moved the map yet. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Remove both the GPS-wait overlay and the viewport-hydration spinner. The hydration read is fast enough that the brief blank frame is less distracting than a flashed spinner, and the GPS-wait overlay only ever appeared on first-ever launch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
center+zoomto EncryptedStorage on each region change (debounced 500ms) via a smallviewportStore.Camera.initialViewStateso element fetches happen immediately for the restored region — no more zoom-1 world view + fly-to-user round trip.useMemodriven byposition+ lastviewportState, so the recenter button can appear as soon as position arrives — even before any pan.Reviewer notes
react-native-encrypted-storagefor consistency withtokenStore. Bounds aren't sensitive, but adding a second storage dep felt like more churn than it's worth.Test plan
🤖 Generated with Claude Code