Hello guys, i'm using `mutableListOf<Int>` t...
# compose
r
Hello guys, i'm using
mutableListOf<Int>
to track my calendar days which are selected in a period of time and then fill the square Grey. When I select a new period of time, I first empty the mutableListOf and later I save on it my new days in order to react and show the Grey square animation. The problem is that when I empty the mutableListOf and quickly select a new period of time, as you see in the beginning of the video, it seems that the mutableList has my old dates on cache? and then only the new days added to the period of time react to the change (the old dates animation doesn't trigger, you just see the square filled). However if I select a new date, and wait some seconds to select the endDay, my animation is triggered in all the days, because the mutableListOf doesn't have any data saved.
l
It looks like the animation hadn’t finished fading yet and you’ve retriggered it by selecting a new time period again. Try changing time in the fade animation and see if the app behaves any different
r
Changing from 500 milis to 200 solve the issue O_o!!! Thanks!!!
z
This sounds dangerous - it’s a bad idea to mutate state that isn’t stored in a snapshot state object. I’m surprised this works at all, but maybe something else is triggering the recomposition so it just works accidentally? It would probably be better nevertheless to use a
mutableStateListOf
or a
mutableStateOf
an immutable list.