Skip to content

Commit 89ae8a2

Browse files
author
kimozhang
committed
fix: 双端比较在非理想情况时, 获取 idxInOld 需要判断 node 是否为空
1 parent 8116d67 commit 89ae8a2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/zh/renderer-diff.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
883883
} else {
884884
// 遍历旧 children,试图寻找与 newStartVNode 拥有相同 key 值的元素
885885
const idxInOld = prevChildren.findIndex(
886-
node => node.key === newStartVNode.key
886+
node => node?.key === newStartVNode.key
887887
)
888888
}
889889
}

0 commit comments

Comments
 (0)