https://kotlinlang.org logo
Title
j

jasu

07/08/2022, 6:44 AM
*In Compose navigation h*ow can I go back to the previous destination without making it recompose? I have screen A which launches B, B pops up & provides some data back to A. When B goes to A again I don’t want A to be recomposed. Is it possible?
s

Stylianos Gakis

07/08/2022, 6:55 AM
1. No I don't think that is possible 2. If you somehow rely on recomposing or not this feels like there's a problem somewhere else. Could you explain why you don't want to recompose?
☝️🏻 1
j

jasu

07/08/2022, 6:59 AM
to avoid making network call again
Screen A makes a network call in LaunchedEffect(Unit)
s

Stylianos Gakis

07/08/2022, 7:10 AM
When you go back do you get the same instance of your ViewModel? Maybe this network call should live there instead?
👆 1
j

jasu

07/08/2022, 7:31 AM
yeh something like this I’ll have to do
s

ste

07/08/2022, 7:42 AM
If you are using compose navigation, you must use viewmodels
2