Skip to content

Commit

Permalink
fix: as per React, functional ref should also detach
Browse files Browse the repository at this point in the history
  • Loading branch information
yuche committed Mar 6, 2018
1 parent 7bf5efa commit 9338a0a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/nerv/src/vdom/ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ export default {
const nextRef = nextVnode != null && nextVnode.ref

if (prevRef !== nextRef) {
if (!isFunction(prevRef) || !isFunction(nextRef)) {
this.detach(lastVnode, prevRef, lastVnode.dom)
}
this.detach(lastVnode, prevRef, lastVnode.dom)
this.attach(nextVnode, nextRef, domNode)
}
},
Expand Down

0 comments on commit 9338a0a

Please sign in to comment.