Arkadii Ivanov
07/26/2021, 10:44 PM3.0.0 , and I have a question/concern. You may noticed, SuspendExecutor has its executeIntent and executeAction methods defined as suspend. The base class SuspendExecutor accepts mainContext, which is usually Dispatchers.Main . Both methods are automatically called from inside launch , which has one important effect. The execution is always scheduled, and so is not synchronous. This may have some unwanted or unpredictable behaviours. The SuspendBootstrapper is affected as well.
I have an idea - to go the same way as ViewModel and its viewModelScope . We can make all methods non-suspend, add val scope: CoroutineScope to the SuspendExecutor class, and let inheritors decide whether they need to switch context or not. The usage will be as on the screenshot (diff change in the sample TodoListStoreFactory).
Please let me know what do you think. Maybe I'm missing something?rsktash
07/27/2021, 4:47 PMCoroutineExecutorArkadii Ivanov
07/27/2021, 4:48 PM