Skip to content

Commit

Permalink
Fixes #899 - Repeated elements with no assigned key are not added to …
Browse files Browse the repository at this point in the history
…lookup when rendered on the server
  • Loading branch information
patrick-steele-idem committed Oct 19, 2017
1 parent db36961 commit 9208d8d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/morphdom/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ function morphdom(


if (compareNodeNames(curToNodeChild, curVFromNodeChild)) {
morphEl(curFromNodeChild, curVFromNodeChild, curToNodeChild, componentForNode);
morphEl(curFromNodeChild, curVFromNodeChild, curToNodeChild, componentForNode, curToNodeKey);
} else {
// Remove the old node
detachNode(curFromNodeChild, parentFromNode, componentForNode);
Expand All @@ -294,7 +294,7 @@ function morphdom(
curFromNodeChild.nodeName === curToNodeChild.___nodeName) {
curVFromNodeChild = virtualizeElement(curFromNodeChild);
curFromNodeChild.___markoKey = curToNodeKey;
morphEl(curFromNodeChild, curVFromNodeChild, curToNodeChild, componentForNode);
morphEl(curFromNodeChild, curVFromNodeChild, curToNodeChild, componentForNode, curToNodeKey);
curToNodeChild = toNextSibling;
curFromNodeChild = fromNextSibling;
continue;
Expand Down Expand Up @@ -358,7 +358,7 @@ function morphdom(
}

if ((curToNodeChild.___flags & FLAG_PRESERVE) === 0) {
morphEl(matchingFromEl, curVFromNodeChild, curToNodeChild, componentForNode);
morphEl(matchingFromEl, curVFromNodeChild, curToNodeChild, componentForNode, curToNodeKey, curToNodeKey);
}


Expand Down Expand Up @@ -424,7 +424,7 @@ function morphdom(
// We found compatible DOM elements so transform
// the current "from" node to match the current
// target DOM node.
morphEl(curFromNodeChild, curVFromNodeChild, curToNodeChild, component);
morphEl(curFromNodeChild, curVFromNodeChild, curToNodeChild, component, curToNodeKey);
}

} else if (curFromNodeType === TEXT_NODE || curFromNodeType === COMMENT_NODE) {
Expand Down Expand Up @@ -485,8 +485,7 @@ function morphdom(
}
}

function morphEl(fromEl, vFromEl, toEl, component) {
var toElKey = toEl.___key;
function morphEl(fromEl, vFromEl, toEl, component, toElKey) {
var nodeName = toEl.___nodeName;

if (isRerenderInBrowser === true && toElKey) {
Expand Down

0 comments on commit 9208d8d

Please sign in to comment.