Parcourir la source

Fixed structured concurrency

Vadik Sirekanyan il y a 2 ans
Parent
commit
1d0fc9bd81
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      app/src/main/java/org/sirekanyan/outline/MainState.kt

+ 2 - 1
app/src/main/java/org/sirekanyan/outline/MainState.kt

@@ -18,6 +18,7 @@ import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.SupervisorJob
 import kotlinx.coroutines.flow.map
+import kotlinx.coroutines.job
 import kotlinx.coroutines.launch
 import kotlinx.coroutines.plus
 import kotlinx.coroutines.withContext
@@ -60,7 +61,7 @@ fun rememberMainState(): MainState {
             }
         }
     }
-    val supervisor = remember { SupervisorJob() }
+    val supervisor = remember { SupervisorJob(scope.coroutineContext.job) }
     val search = rememberSearchState()
     val page = rememberSaveable { mutableStateOf<Page>(HelloPage) }
     val dialog = rememberSaveable { mutableStateOf<Dialog?>(null) }