ryanw-mobile / OctoMeter

🔥Kotlin Multiplatform Desktop/Android/iOS Energy Tracker app
Other
88 stars 8 forks source link

(#143) Fix Agile screen countdown pass API boundaries #165

Closed ryanw-mobile closed 1 month ago

ryanw-mobile commented 1 month ago

There is a well-known but often forgotten LaunchedEffect characteristic we have again overlooked. The LaunchedEffect is locked to using a fixed instance of rateGroupedCells, so it keeps on looping the countdown. It does not refresh to take an updated version of rateGroupedCells as the API supplies more upcoming data, so eventually, the LaunchedEffect exhausts the data in the old rateGroupedCells instance.

The fix is to restart the LaunchedEffect when we have received an updated rateGroupedCell.