You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/flipcash/features/tokens/src/main/kotlin/com/flipcash/app/tokens/internal/components/marketcap/MarketCapChart.kt
+9-3Lines changed: 9 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -82,17 +82,23 @@ internal fun MarketCapChart(
82
82
mutableStateOf<List<MarketCapPoint>>(emptyList())
83
83
}
84
84
85
-
LaunchedEffect(data) {
85
+
// Track the period that corresponds to the current historicalData so we
86
+
// don't collapse stale data with a new period (which produces an
87
+
// intermediate curve that causes Vico to animate from the bottom).
88
+
var dataPeriod by remember { mutableStateOf(selectedPeriod) }
89
+
90
+
LaunchedEffect(data, selectedPeriod) {
86
91
if (data.isNotEmpty()) {
87
92
historicalData = data
93
+
dataPeriod = selectedPeriod
88
94
}
89
95
}
90
96
91
97
val modelProducer = remember { CartesianChartModelProducer() }
92
98
93
-
val windowedData by remember(historicalData, selectedPeriod) {
99
+
val windowedData by remember(historicalData, dataPeriod) {
0 commit comments