Skip to content

Commit

Permalink
Revert "Use copied VNode as newVNode instead of oldVNode when rerende…
Browse files Browse the repository at this point in the history
…ring (#4171)"

This reverts commit 8e5eac5.
  • Loading branch information
andrewiggins committed Nov 12, 2023
1 parent 2f31796 commit 7b18b6a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,22 @@ export function getDomSibling(vnode, childIndex) {
* @param {Component} component The component to rerender
*/
function renderComponent(component) {
let oldVNode = component._vnode,
oldDom = oldVNode._dom,
let newVNode = component._vnode,
oldDom = newVNode._dom,
parentDom = component._parentDom,
commitQueue = [],
refQueue = [];

if (parentDom) {
const newVNode = assign({}, oldVNode);
const oldVNode = assign({}, newVNode);
newVNode._original = oldVNode._original + 1;

if (oldVNode._children) {
oldVNode._children.forEach(child => {
if (child) child._parent = oldVNode;
});
}

diff(
parentDom,
newVNode,
Expand All @@ -144,7 +150,6 @@ function renderComponent(component) {
refQueue
);

newVNode._parent._children[newVNode._index] = newVNode;
commitRoot(commitQueue, newVNode, refQueue);

if (newVNode._dom != oldDom) {
Expand Down

0 comments on commit 7b18b6a

Please sign in to comment.