Skip to content

Commit

Permalink
[fix] 돔 삭제 로직 에러 수정 #28
Browse files Browse the repository at this point in the history
- 실제 돔 노드 삭제시 재귀호출을 하였더니 무한루프 발생
- 로직 수정
  • Loading branch information
ji3427 committed Dec 3, 2020
1 parent 83ad6f6 commit 0b8ec4f
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/boostact/Boostact.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,17 +244,12 @@ const updateNode = (currentNode) => {
}
};

const deleteNode = (currentNode) => {
currentNode.parent.dom.removeChild(currentNode);
deletionQueue.unshift();
};

const reflectDOM = (node) => {
let currentNode = node;
deletionQueue.forEach((node) => {
reflectDOM(node);
node.parent.dom.removeChild(node.dom);
});

deletionQueue.length = 0;
while (currentNode) {
switch (currentNode.effectTag) {
case "PLACEMENT":
Expand All @@ -263,9 +258,6 @@ const reflectDOM = (node) => {
case "UPDATE":
updateNode(currentNode);
break;
case "DELETION":
deleteNode(currentNode);
break;
case "NONE":
break;
default:
Expand Down

0 comments on commit 0b8ec4f

Please sign in to comment.