Semyon Zadorozhnyi
04/30/2021, 3:20 PMSemyon Zadorozhnyi
04/30/2021, 3:21 PMSemyon Zadorozhnyi
04/30/2021, 3:21 PMSemyon Zadorozhnyi
04/30/2021, 3:21 PMZach Klippenstein (he/him) [MOD]
04/30/2021, 4:46 PMSnapshotStateListZach Klippenstein (he/him) [MOD]
04/30/2021, 4:49 PMCoroutineScope directly from classes that do other things. Store the scope in a property instead (elizarov has written about this).
2. No need to pass Dispatchers.Main to collectAsState, it will use the compose dispatcher by default (which is basically Dispatchers.Main with extra features).
3. There’s a potential data race in your subscribe coroutine, if there are multiple instances of that coroutine running concurrently. One way to fix would be wrap the body of the collect with a Mutex.Semyon Zadorozhnyi
04/30/2021, 4:52 PMNo need to passThat’s just attempt to fix the problem by changing something random 😄toDispatchers.MaincollectAsState