Open BitMavrick opened 1 year ago
I've noticed this too. When you change the layout to grid and the preference is stored, when relaunching the app it will display the linear layout for a split second before switching to grid (it may not be visible in release configuration but I am not sure).
I am not sure of the exact cause of this but I think it occurs when we convert our cold flow to a hot one in the viewmodel, it could have something to do with the initialValue
parameter.
I also noticed it. It is because of DataStore feature, which supports fully asynchronous work, not synchronous.
In the ViewModel there's code ,
data class DessertReleaseUiState( val isLinearLayout: Boolean = true, val toggleContentDescription: Int = if (isLinearLayout) R.string.grid_layout_toggle else R.string.linear_layout_toggle, val toggleIcon: Int = if (isLinearLayout) R.drawable.ic_grid_layout else R.drawable.ic_linear_layout )
which shows the default settings, after in very short delay the preference setting restored. I think it would be nice to showing any splash screen or some loading animation in the meantime that moment of time