Skip to content

Commit 2188e7d

Browse files
Applying replay value of 1 to SharedFlow
1 parent fb17a51 commit 2188e7d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/src/main/java/com/lukaslechner/coroutineusecasesonandroid/usecases/flow/usecase4/FlowUseCase4ViewModel.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class FlowUseCase4ViewModel(
2121
Timber.tag("Flow").d("Flow has completed.")
2222
}.shareIn(
2323
scope = viewModelScope,
24-
started = SharingStarted.WhileSubscribed()
24+
started = SharingStarted.WhileSubscribed(stopTimeoutMillis = 5000),
25+
replay = 1
2526
)
2627
}

0 commit comments

Comments
 (0)