Suppose you have a compose dialog, and on closing ...
# compose-android
m
Suppose you have a compose dialog, and on closing the dialog, some viewmodel suspending function is called to update some data. If using the scope from
rememberCoroutineScope()
then there is the danger that the operation will not complete because the scope will be cancelled. Which is the best way to mitigate this? Use
NonCancellable
? Let the viewmodel force the scope to use, in which case expose a non-suspending function instead? Something else?
r
if data that is updating and reflecting the ui outside the compose dialog then go with state updation. if function is not returning any data then change suspending function to normal function and use viewmodelscope.