Don't reframe the route on ordinary arrivals polls (#1895)#1896
Merged
Conversation
In stop + route focus, onArrivalsLoaded re-emits the selected route's ShowRoute directive on every arrivals load with frameRoute derived only from preserveViewport. On an ordinary poll preserveViewport is false, so frameRoute was true — routing through RouteMapController.reframe -> host.frameRoute() and snapping the camera back to the whole route's extent, discarding whatever the rider had panned/zoomed to. Frame the selected route only when the load is the initial (restore/deep-link) focus establishment. On an ordinary poll refresh the ShowRoute re-emission now carries frameRoute=false, so reframe() is a no-op (direction unchanged, no focusTripId) and the camera stays put. The initial route selection still frames via selectStopRoute's default frameRoute=true. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe home view model now reframes a selected route only during initial map focus. Subsequent arrivals polls refresh the route without reframing the camera, with a unit test covering both behaviors. ChangesRoute framing refresh control
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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
Fixes #1895. In stop + route focus, an ordinary background arrivals poll
reframed the camera to the whole route's extent, throwing away the pan/zoom the
rider had set.
Root cause
HomeViewModel.onArrivalsLoadedruns on every arrivals load. When a routeis selected within a focused stop, it re-emits
MapDirective.ShowRoute(..., stopScoped = true, frameRoute = !preserveViewport). On an ordinary pollpreserveViewportisfalse, soframeRoutewastrue. That routes throughMapViewModel.toRoute→RouteMapController.reframe(frameRoute = true)→host.frameRoute(), re-fitting the camera to the whole route on every poll.(The retained-
FramingIntent.Routetheory in the issue was a red herring — thereal trigger is the per-poll
ShowRoutere-emission.)Fix
Frame the selected route only when the load is the initial (restore /
deep-link) focus establishment:
pendingMapFocus == false→frameSelectedRoute == false.The
ShowRoutere-emission still refreshes presentation, butreframe()is ano-op (direction unchanged, no
focusTripId), so the camera stays put.The initial route selection continues to frame via
selectStopRoute's defaultframeRoute = true; the back/undo restore paths already pass their own explicitframeRoute, so they're unaffected.Tests
Added
an ordinary arrivals poll refreshes the selected route without reframingto
HomeViewModelTest: selects a route in stop focus (asserts the initialShowRouteframes), then a subsequentonArrivalsLoadedwith no pending focusre-shows the route with
frameRoute = false../gradlew :onebusaway-android:testObaGoogleDebugUnitTest --tests 'org.onebusaway.android.ui.home.*' --tests 'org.onebusaway.android.map.*' -PwarningsAsErrors=trueNote
Root cause was found by reading the code, not reproduced on-device — worth a
manual confirmation on the shared phone before merge.
🤖 Generated with Claude Code
Summary by CodeRabbit