Skip to content

Commit

Permalink
Post to the message queue when resetting a NavHostFragment and waitin…
Browse files Browse the repository at this point in the history
…g for it to complete. This works around a bug seen in Basecamp where resetting the NavHostFragment and then recreating the Activity to update its theme would cause the app to crash.
  • Loading branch information
jayohms committed Apr 28, 2022
1 parent e659f08 commit fb62287
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ abstract class TurboSessionNavHostFragment : NavHostFragment() {
currentNavDestination.clearBackStack {
session.reset()
initControllerGraph()
onReset()

if (view == null) {
onReset()
} else {
requireView().post { onReset() }
}
}
}
}
Expand Down

0 comments on commit fb62287

Please sign in to comment.