HomeViewModel: replace pendingMapFocus boolean pair with a PendingFocus data class#1917
Merged
Merged
Conversation
…1903) markPendingMapFocus() previously set pendingMapFocus/animatePendingMapFocus but left preserveViewportForPendingMapFocus untouched, so revealStop() after a stalled back-restore (arrivals never loaded) could inherit a stale preserveViewport=true and suppress the recenter/frame on the newly revealed stop. A single nullable PendingFocus latch makes every mark atomic, so the stale flag can no longer survive across an unrelated focus change. Co-Authored-By: Claude Sonnet 5 <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
pendingMapFocus/preserveViewportForPendingMapFocushad to be kept in sync by hand:markPendingMapFocus()set the first but never reset the second, so a stalled back-restore (arrivals never load, e.g. a network failure) followed byrevealStop()(search/nav) could inherit a stalepreserveViewport=trueand suppress the recenter/frame on the newly revealed stop.animatePendingMapFocus) with one nullablePendingFocusdata class, set atomically bymarkPendingMapFocus(animate, preserveViewport). Every call site (revealStop,applyInitialFocus,restoreMapAfterBack,clearMapFocus,onArrivalsLoaded) now goes through the single latch, so the invalid stale-flag state is no longer representable.Test plan
./gradlew :onebusaway-android:compileObaGoogleDebugKotlin -PwarningsAsErrors=true— builds clean under the CI strict-warnings gate../gradlew :onebusaway-android:testObaGoogleDebugUnitTest --tests "org.onebusaway.android.ui.home.HomeViewModelTest"— passes (existing coverage formarkPendingMapFocus/onArrivalsLoadedunaffected, default params preserve compatibility).🤖 Generated with Claude Code