Skip to content

Commit 68ec3fc

Browse files
committed
fix: error in hoc
1 parent 07b3130 commit 68ec3fc

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

packages/nerv/src/vdom/patch.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ import {
1414
import { unmount, unmountChildren } from './unmount'
1515

1616
export function patch (lastVnode, nextVnode, lastDom, context, isSVG?: boolean) {
17-
lastDom = lastVnode.dom || lastDom
18-
if (isInvalid(lastVnode)) {
19-
throw new Error('lastdom is invalid')
20-
}
17+
lastDom = (lastVnode && lastVnode.dom) || lastDom
2118
if (lastVnode === nextVnode) {
2219
return lastDom
2320
}
@@ -41,14 +38,7 @@ export function patch (lastVnode, nextVnode, lastDom, context, isSVG?: boolean)
4138
}
4239
(nextVnode as any).dom = newDom
4340
} else {
44-
let parentNode
45-
try {
46-
parentNode = lastDom.parentNode
47-
} catch (error) {
48-
console.log('lastDom is', lastVnode)
49-
console.log('nextVnode is', nextVnode)
50-
}
51-
// const parentNode = lastDom.parentNode
41+
const parentNode = lastDom.parentNode
5242
const nextSibling = lastDom.nextSibling
5343
unmount(lastVnode, parentNode)
5444
newDom = createElement(nextVnode)

packages/nerv/src/vdom/unmount.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function unmountChildren (children, parentDom?) {
1111
}
1212

1313
export function unmount (vnode, parentDom?) {
14-
if (vnode === null) {
14+
if (isInvalid(vnode)) {
1515
return
1616
}
1717

0 commit comments

Comments
 (0)