Skip to content

Commit 1aa6a62

Browse files
authored
Minor fix to ConsistentLiveData
1 parent 38296bf commit 1aa6a62

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/src/main/java/com/lagradost/cloudstream3/utils/ConsistentLiveData.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ import androidx.lifecycle.LiveData
55
import com.lagradost.cloudstream3.mvvm.Resource
66

77
/**
8-
* This is an atomic LiveData where you can do .value instantly after doing .postValue
8+
* This is an atomic LiveData where you can do .value instantly after doing .postValue.
9+
*
10+
* The default behavior is a footgun that will cause race conditions,
11+
* as we do not really care if it is posted as we only want the latest data (even in the binding).
912
*
1013
* Fuck all that is LiveData, because we want this value to be accessible everywhere instantly.
1114
* */
12-
open class ConsistentLiveData<T>(initValue : T? = null) : LiveData<T>() {
15+
open class ConsistentLiveData<T>(initValue : T? = null) : LiveData<T>(initValue) {
1316
@Volatile private var internalValue : T? = initValue
1417

1518
override fun getValue(): T? {

0 commit comments

Comments
 (0)