Skip to content

Commit

Permalink
chore: Remove await cancellation
Browse files Browse the repository at this point in the history
  • Loading branch information
Distractic committed Dec 23, 2023
1 parent 3259de4 commit 2fd2115
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/main/kotlin/com/github/rushyverse/api/gui/GUI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.awaitCancellation
import kotlinx.coroutines.cancelAndJoin
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.asFlow
Expand Down Expand Up @@ -264,12 +263,7 @@ public abstract class GUI<T>(
// Will fill the inventory bit by bit.
inventoryFlowItems.collect { (index, item) -> inventory.setItem(index, item) }
} else {
val loadingAnimationJob = launch {
loadingAnimation.loading(key, inventory)
// If the loading function is finished, the "loading" state must be continued
// until the flow is finished.
awaitCancellation()
}
val loadingAnimationJob = launch { loadingAnimation.loading(key, inventory) }

// To avoid conflicts with the loading animation,
// we need to store the items in a temporary inventory
Expand Down

0 comments on commit 2fd2115

Please sign in to comment.