Repository navigation
Conversation
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.
Preparing a web destination can post a WebView-detachment callback that outlives the fragment view's lifecycle coroutine. If the host or originating view is removed or recreated before that callback runs,
Navigator.reset()can resume against an obsolete graph and throwIllegalStateException: No configuration found for NavigatorHost.Guard
navigateWhenReadyat the navigation continuation, checking the original host view, destination view lifecycle and current destination. Detachment and bridge cleanup still run before the guard. Calls made after host removal are ignored. This changes no public API and does not require a view to be STARTED, so live detached views can still complete navigation.The standalone Robolectric fixture reproduces the failure by requesting a reset, removing the host before draining the main looper, then running the posted callback. It also covers activity destruction, view recreation, reentrant teardown, bridge cleanup, an already-removed host, and valid reset/route/detached-view completion. Six of its nine cases fail on the current base commit and all nine pass with the fix.
Validation on base
56e02c8d9488370ddfdaf325f777ecf89a2e5b8dplus this change:./gradlew :navigation-fragments:testDebugUnitTest --tests dev.hotwire.navigation.navigator.NavigatorPendingNavigationTest./gradlew testRelease core:lint :navigation-fragments:lint --continue— 321 release tests, no failures or skips; both lint checks pass.The same pending-callback sequence is present in 1.3.1. A downstream workaround is carrying an equivalent source patch until a release includes the fix.