Skip to content

Commit

Permalink
Add comments to dom_patch.js
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim authored Nov 6, 2023
1 parent 0f67cf1 commit ce7c2f0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions assets/js/phoenix_live_view/dom_patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ export default class DOMPatch {
childrenOnly: targetContainer.getAttribute(PHX_COMPONENT) === null,
getNodeKey: (node) => {
if(DOM.isPhxDestroyed(node)){ return null }
// If we have a join patch, then by definition there was no PHX_MAGIC_ID.
// This is important to reduce the amount of elements morphdom discards.
if(isJoinPatch){ return node.id }
return node.id || (node.getAttribute && node.getAttribute(PHX_MAGIC_ID))
},
Expand Down

0 comments on commit ce7c2f0

Please sign in to comment.