diff --git a/feature/channel/src/main/java/com/m3u/feature/channel/components/PlayerPanel.kt b/feature/channel/src/main/java/com/m3u/feature/channel/components/PlayerPanel.kt index ae3ccf12..c7573c26 100644 --- a/feature/channel/src/main/java/com/m3u/feature/channel/components/PlayerPanel.kt +++ b/feature/channel/src/main/java/com/m3u/feature/channel/components/PlayerPanel.kt @@ -39,7 +39,6 @@ import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.material3.surfaceColorAtElevation import androidx.compose.runtime.Composable -import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.Immutable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue @@ -135,7 +134,6 @@ internal fun PlayerPanel( animProgramme = it } ) - val currentProgramme = animProgramme LaunchedEffect(isPanelExpanded) { if (!isPanelExpanded) { programme = null @@ -152,6 +150,7 @@ internal fun PlayerPanel( onClick = { programme = null } ) ) { + val currentProgramme = animProgramme if (currentProgramme != null) { Surface( color = MaterialTheme.colorScheme.surfaceContainer, @@ -243,10 +242,6 @@ internal fun PlayerPanel( } } } - - DisposableEffect(Unit) { - onDispose { animProgramme = null } - } } BackStackHandler( entry = BackStackEntry(Icons.Rounded.Close), diff --git a/feature/channel/src/main/java/com/m3u/feature/channel/components/ProgrammeGuide.kt b/feature/channel/src/main/java/com/m3u/feature/channel/components/ProgrammeGuide.kt index aa2db424..13138527 100644 --- a/feature/channel/src/main/java/com/m3u/feature/channel/components/ProgrammeGuide.kt +++ b/feature/channel/src/main/java/com/m3u/feature/channel/components/ProgrammeGuide.kt @@ -302,6 +302,7 @@ private fun ProgrammeCell( modifier: Modifier = Modifier, onPressed: () -> Unit ) { + val currentOnPressed by rememberUpdatedState(onPressed) val spacing = LocalSpacing.current val preferences = hiltPreferences() val leanback = leanback() @@ -367,7 +368,7 @@ private fun ProgrammeCell( } } catch (_: PointerEventTimeoutCancellationException) { down.consume() - onPressed() + currentOnPressed() hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress) isPressed = true do {