fix(browse): Unsubscribe before restarting pager

This commit is contained in:
Ahmad Ansori Palembani 2024-12-20 20:52:45 +07:00
parent 9e5262140e
commit 3606f67dba
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
2 changed files with 7 additions and 0 deletions

View file

@ -752,6 +752,11 @@ open class BrowseSourceController(bundle: Bundle) :
binding.progress.isVisible = false binding.progress.isVisible = false
} }
fun unsubscribe() {
watchJob?.cancel()
watchJob = null
}
/** /**
* Workaround to fix data state de-sync issues when controller detached, * Workaround to fix data state de-sync issues when controller detached,
* and attaching flow directly into Item caused some flickering issues. * and attaching flow directly into Item caused some flickering issues.

View file

@ -171,6 +171,8 @@ open class BrowseSourcePresenter(
val sourceListType = preferences.libraryLayout() val sourceListType = preferences.libraryLayout()
val outlineCovers = uiPreferences.outlineOnCovers() val outlineCovers = uiPreferences.outlineOnCovers()
view?.unsubscribe()
// Prepare the pager. // Prepare the pager.
pagerJob?.cancel() pagerJob?.cancel()
pagerJob = presenterScope.launchIO { pagerJob = presenterScope.launchIO {