mirror of
https://github.com/divkit/divkit.git
synced 2026-05-07 20:02:32 +00:00
skip unnecessary async binding with the same data
commit_hash:f80d697d7c5ce8e0198909a83f1ce51fb133975e
This commit is contained in:
@@ -295,8 +295,16 @@ class Div2View private constructor(
|
||||
data: DivData?,
|
||||
tag: DivDataTag,
|
||||
onComplete: ((Boolean) -> Unit)?,
|
||||
): Unit = bindingDispatcher.runOnBindingThread(onComplete) {
|
||||
setDataInternal(data, divData, tag)
|
||||
) {
|
||||
if (data === divData) {
|
||||
loadMedia()
|
||||
onComplete?.invoke(true)
|
||||
return
|
||||
}
|
||||
|
||||
bindingDispatcher.runOnBindingThread(onComplete) {
|
||||
setDataInternal(data, divData, tag)
|
||||
}
|
||||
}
|
||||
|
||||
@ExperimentalApi
|
||||
@@ -305,8 +313,16 @@ class Div2View private constructor(
|
||||
oldDivData: DivData?,
|
||||
tag: DivDataTag,
|
||||
onComplete: ((Boolean) -> Unit)?,
|
||||
): Unit = bindingDispatcher.runOnBindingThread(onComplete) {
|
||||
setDataInternal(data, oldDivData ?: divData, DivDataTag(tag.id))
|
||||
) {
|
||||
if (data === divData) {
|
||||
loadMedia()
|
||||
onComplete?.invoke(true)
|
||||
return
|
||||
}
|
||||
|
||||
bindingDispatcher.runOnBindingThread(onComplete) {
|
||||
setDataInternal(data, oldDivData ?: divData, DivDataTag(tag.id))
|
||||
}
|
||||
}
|
||||
|
||||
fun setData(
|
||||
|
||||
Reference in New Issue
Block a user