Merge pull request #351 from caridy/caridy/issue-348

fixes issue #348: perf optimization during diffing algo to avoid calling addVNodes and removeVNodes when there is nothing to do
pull/354/head
Caridy Patiño 7 years ago committed by GitHub
commit dbb4d2dae5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -240,11 +240,13 @@ export function init(modules: Array<Partial<Module>>, domApi?: DOMAPI) {
}
}
}
if (oldStartIdx > oldEndIdx) {
before = newCh[newEndIdx+1] == null ? null : newCh[newEndIdx+1].elm;
addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
} else if (newStartIdx > newEndIdx) {
removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
if (oldStartIdx > oldEndIdx) {
before = newCh[newEndIdx+1] == null ? null : newCh[newEndIdx+1].elm;
addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
} else {
removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
}
}
}

Loading…
Cancel
Save