Skip to content

Commit 79a2d9a

Browse files
committed
Shared flow should always have content
1 parent 46bf381 commit 79a2d9a

File tree

1 file changed

+3
-1
lines changed
  • kotlin-sdk/src/commonMain/kotlin/dev/openfeature/kotlin/sdk/multiprovider

1 file changed

+3
-1
lines changed

kotlin-sdk/src/commonMain/kotlin/dev/openfeature/kotlin/sdk/multiprovider/MultiProvider.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import kotlinx.coroutines.coroutineScope
1414
import kotlinx.coroutines.flow.Flow
1515
import kotlinx.coroutines.flow.MutableSharedFlow
1616
import kotlinx.coroutines.flow.asSharedFlow
17+
import kotlinx.coroutines.flow.first
18+
import kotlinx.coroutines.flow.firstOrNull
1719
import kotlinx.coroutines.flow.launchIn
1820
import kotlinx.coroutines.flow.onEach
1921

@@ -119,7 +121,7 @@ class MultiProvider(
119121

120122
// If the status has been updated, calculate what our new event should be
121123
if (hasStatusUpdated) {
122-
val currPrecedenceVal = eventFlow.replayCache.firstOrNull()?.run { eventPrecedence[this::class] } ?: 0
124+
val currPrecedenceVal = eventFlow.first().run { eventPrecedence[this::class] } ?: 0
123125
val updatedPrecedenceVal = eventPrecedence[event::class] ?: 0
124126

125127
if (updatedPrecedenceVal > currPrecedenceVal) {

0 commit comments

Comments
 (0)