Skip to content

Commit

Permalink
fix: IllegalStateException on supportFragmentManager.popBackStack()
Browse files Browse the repository at this point in the history
- Ensure `MutableStateFlow` is lifecycle-aware by utilizing `collectAsStateWithLifecycle`.
  • Loading branch information
farhan-arshad-dev committed Sep 5, 2024
1 parent b28b6e2 commit 00ace3e
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 00ace3e

Please sign in to comment.