Skip to content

Commit

Permalink
Only observe modal result changes if the current Fragment is not a `m…
Browse files Browse the repository at this point in the history
…odal` context. This works around a race condition bug when popping the backstack and sending the modal result back to a default context.
  • Loading branch information
jayohms committed May 3, 2022
1 parent 32feebc commit 0a2badd
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ abstract class TurboFragment : Fragment(), TurboNavDestination {
}

private fun observeModalResult() {
delegate.sessionViewModel.modalResult.observe(viewLifecycleOwner) { event ->
if (shouldHandleModalResults()) {
if (shouldHandleModalResults()) {
delegate.sessionViewModel.modalResult.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled()?.let {
onStartAfterModalResult(it)
}
Expand Down

0 comments on commit 0a2badd

Please sign in to comment.