Potential bug in handling of updates for widgets
Author: imecklerCreated Mar 18, 2016Updated May 19, 2019
This is in reference to the code here. Namely,
function updateWidget(a, b) {
if (isWidget(a) && isWidget(b)) {
if ("name" in a && "name" in b) {
return a.id === b.id
} else {
return a.init === b.init
}
}
return false
}It seems strange that it is checking for the mere presence of a field called name and then checking equality of the id fields. I would imagine the intent is more like
function updateWidget(a, b) {
if (isWidget(a) && isWidget(b)) {
if ("id" in a && "id" in b) {
return a.id === b.id
} else {
return a.init === b.init
}
}
return false
}Source: Matt-Esch/virtual-dom