fix(chart): clear tap marker when dataset changes

LaunchedEffect(data) resets marker state so stale selection is not shown after refresh or sensor switch.

Made-with: Cursor
This commit is contained in:
2026-03-24 00:05:40 +01:00
parent 24c5731c69
commit fc034ad520

View File

@@ -13,6 +13,7 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -100,6 +101,11 @@ fun AirMQChart(
var markerPoint: ChartDataPoint? by remember { mutableStateOf(null) }
var showMarker by remember { mutableStateOf(false) }
LaunchedEffect(data) {
markerPoint = null
showMarker = false
}
val sortedPoints = remember(points) {
points.sortedBy { it.timestamp }
}