This commit is contained in:
2023-11-30 01:05:01 +06:00
parent 22d7ac3e22
commit 6f174cae1d
2 changed files with 22 additions and 21 deletions

View File

@@ -16,7 +16,7 @@ interface SpecialMutableStateFlow<T> : StateFlow<T>, FlowCollector<T>, MutableSh
) : SpecialMutableStateFlow<T> {
protected val internalSharedFlow: MutableSharedFlow<T> = MutableSharedFlow(
replay = 0,
extraBufferCapacity = 1,
extraBufferCapacity = 2,
onBufferOverflow = BufferOverflow.DROP_OLDEST
)
protected val publicSharedFlow: MutableSharedFlow<T> = MutableSharedFlow(
@@ -32,7 +32,7 @@ interface SpecialMutableStateFlow<T> : StateFlow<T>, FlowCollector<T>, MutableSh
_value = value
publicSharedFlow.emit(value)
}
protected val job = internalSharedFlow.subscribeSafelyWithoutExceptions(internalScope) {
protected val job = internalSharedFlow.subscribe(internalScope) {
if (_value != it) {
onChange(it)
}