Skip to content

Commit

Permalink
Fix ViewModels IllegalStateException (#4720)
Browse files Browse the repository at this point in the history
Task/Issue URL:
https://app.asana.com/0/1200204095367872/1207733727777585/f

### Description
Only executes tab hidden/shown logic if the fragment is attached.

### Steps to test this PR
- [ ] Code review.
  • Loading branch information
joshliebe authored Jul 5, 2024
1 parent 8646021 commit cf44b5d
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2924,12 +2924,14 @@ class BrowserTabFragment :
}

private fun onTabHidden() {
if (!isAdded) return
viewModel.onViewHidden()
downloadMessagesJob.cancel()
webView?.onPause()
}

private fun onTabVisible() {
if (!isAdded) return
webView?.onResume()
launchDownloadMessagesJob()
viewModel.onViewVisible()
Expand Down

0 comments on commit cf44b5d

Please sign in to comment.