Skip to content

Commit

Permalink
fix: IllegalStateException on `supportFragmentManager.popBackStack(…
Browse files Browse the repository at this point in the history
…)` (#379)

- Ensure `MutableStateFlow` is lifecycle-aware by utilizing `collectAsStateWithLifecycle`.

Co-authored-by: Farhan Arshad <[email protected]>
  • Loading branch information
dixidroid and farhan-arshad-dev authored Oct 7, 2024
1 parent 1dc72d2 commit f66b3f2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ dependencies {
api "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
api "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
api "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
api "androidx.lifecycle:lifecycle-runtime-compose:$lifecycle_version"

// Fullstory
api 'com.fullstory:instrumentation-full:1.47.0@aar'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.material.rememberScaffoldState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
Expand All @@ -41,6 +40,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.zIndex
import androidx.core.os.bundleOf
import androidx.fragment.app.Fragment
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import org.koin.androidx.viewmodel.ext.android.viewModel
import org.koin.core.parameter.parametersOf
import org.openedx.core.module.db.DownloadModel
Expand Down Expand Up @@ -80,7 +80,7 @@ class DownloadQueueFragment : Fragment() {
setContent {
OpenEdXTheme {
val windowSize = rememberWindowSize()
val uiState by viewModel.uiState.collectAsState(DownloadQueueUIState.Loading)
val uiState by viewModel.uiState.collectAsStateWithLifecycle(DownloadQueueUIState.Loading)

DownloadQueueScreen(
windowSize = windowSize,
Expand Down

0 comments on commit f66b3f2

Please sign in to comment.