Skip to content

Commit

Permalink
fixies
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Nov 11, 2023
1 parent bc6191d commit b804e6f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions packages/core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ function replaceComponent(OldType, NewType, resetHookState) {
vnode[VNODE_COMPONENT].context
);

newInst['__v'] = vnode;
oldInst['__v'] = vnode;

vnode[VNODE_COMPONENT] = newInst;
// copy old properties onto the new instance.
// - Objects (including refs) in the new instance are updated with their old values
Expand All @@ -96,6 +99,7 @@ function replaceComponent(OldType, NewType, resetHookState) {
} catch (e) {
/* Functional component */
vnode[VNODE_COMPONENT].constructor = NewType;
vnode[VNODE_COMPONENT].__v = vnode;
}

if (resetHookState) {
Expand Down
15 changes: 9 additions & 6 deletions packages/core/src/runtime/vnode.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ options.vnode = vnode => {
}

vnode.type = foundType;
if (
vnode[VNODE_COMPONENT] &&
'prototype' in vnode.type &&
vnode.type.prototype.render
) {
vnode[VNODE_COMPONENT].constructor = vnode.type;
if (vnode[VNODE_COMPONENT]) {
vnode[VNODE_COMPONENT].__v = vnode;
if (
'prototype' in vnode.type &&
vnode.type.prototype.render
) {
vnode[VNODE_COMPONENT].constructor = vnode.type;
}
}

}

if (oldVnode) oldVnode(vnode);
Expand Down

0 comments on commit b804e6f

Please sign in to comment.