Repository navigation
chore(navigation-app): stop cancelling the pending route future when a new destination is picked - #1094
Merged
Conversation
…a new destination is picked
Contributor
Coverage (instrumentation tests)
|
Coverage (unit tests)Compared against
Line and branch coverage from unit test reports. History is recorded on the |
dkhawk
approved these changes
Nov 24, 2026
dkhawk
left a comment
Collaborator
There was a problem hiding this comment.
LGTM! Clean fix and clear explanation of why the Navigation SDK future shouldn't be cancelled on coroutine cancellation.
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.
The Navigation SDK sample app added in #1061 crashes when a new destination is picked while the previous route is still being calculated:
navigateToLatLngandnavigateToPlacecancel the previousnavigationJob, andstartNavigationToWaypointreacted to that by callingrouteStatusFuture.cancel(true)on the pendingsetDestinationfuture. The Navigation SDK then throws when it delivers the cancelled future on the main thread, which kills the app.This removes the
cancel(true)call. A newsetDestination()(orclearDestinations()fromstopNavigation()) already replaces the pending route in the SDK, and the result listener already ignores late results once its coroutine is no longer active. The existing superseded-destination test now checks that the future is never cancelled.Only the sample app changes, so it is marked as a chore to avoid a library release.
Testing
:navigation-app:testDebugUnitTest: 17 tests, all passing.:navigation-app:lintDebug: passing.main: crashed withTask was cancelledin 2 of 2 runs.