diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/MainScreenScaffold.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/MainScreenScaffold.kt index fe3d60b37..6b83c5244 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/MainScreenScaffold.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/MainScreenScaffold.kt @@ -134,6 +134,12 @@ fun MainScreenScaffold( ) { AnimatedContent( targetState = weather, + // Keyed on the location, not the whole Weather object: a plain data + // refresh produces a new Weather instance (different lastUpdatedInMilli + // etc.) even when nothing visually changed, which made every refresh + // full-screen crossfade instead of just recomposing the changed values - + // only an actual location switch should get the transition. + contentKey = { it?.location?.id }, transitionSpec = { fadeIn() togetherWith fadeOut() }