NTP-3187 | AS | recreation of timer on data change fix (#12446)

This commit is contained in:
Ayushman Sharma
2024-09-10 13:11:08 +05:30
committed by GitHub
parent d84a80ca3e
commit 0b80edbc8d

View File

@@ -37,8 +37,8 @@ constructor(val countDownHelper: ICountDownHelper, val timerStrategyFactory: Tim
) {
super.Render(property, uiTronData, uiTronViewModel, modifier)
val countDownTimerData = uiTronData as? CountDownTextData
var timeLeft by remember { mutableStateOf(countDownTimerData?.timeLeft) }
var timeLeft by
remember(countDownTimerData?.timeLeft) { mutableStateOf(countDownTimerData?.timeLeft) }
val textData by
remember(timeLeft) {
mutableStateOf(
@@ -72,7 +72,7 @@ constructor(val countDownHelper: ICountDownHelper, val timerStrategyFactory: Tim
}
}
LaunchedEffect(Unit) {
LaunchedEffect(countDownTimerData?.timeLeft) {
countDownHelper.cancelTimer(property.layoutId.orEmpty())
countDownHelper.startTimer(
timerId = property.layoutId.orEmpty(),