Can someone explain to me why after upgrading to c...
# compose
a
Can someone explain to me why after upgrading to compose stable this code would fire the sideeffect twice after launching the app
Copy code
SideEffect {
        viewModel.getPlatforms()
    }
In other words viewModel.getPlatforms fires twice where as it didn’t use to be the case before. Perhaps I was misusing the api before
o
SideEffect is triggered every time recomposition of your composable happens. If you want to run some code only once during lifetime of your composable use LaunchedEffect instead.
☝🏻 1
a
Ahh I thought as much. I never ran into the problem before so assumed I was using it correctly. Thanks for letting me know
🙌 1
z
or
DisposableEffect
if you don’t need a coroutine