pawegio
01/22/2021, 8:49 AMonDispose()
are safe to perform such action or it’s rather considered as an anti-pattern/might lead to unexpected state (is there a risk of recomposition causing not intended navigation?). See example code below (where isInProgress
is a part of collected state false
by default):
if (isInProgress) {
CircularProgressIndicator()
onDispose {
navigateToDone()
}
}
jim
01/22/2021, 10:40 AMisInProgress
, although it's a little hard to say for sure, depending on how tightly that code is coupled with the UI vs. general data layer. I get what you're trying to do there though, presumably you're trying to have a button or whatever that goes into some sort of spinning state and only subsequently pushes a new route into navigation whereby back button works. Not sure what the best way to model this would be. cc @Adam Powell for ideas.pawegio
01/22/2021, 11:47 AMAdam Powell
01/22/2021, 3:53 PMisInProgress
from true
to false
when the async operation is done and you've found the spot to dispatch your navigation request.