Throw self-returning component to avoid infinite loop #1260

This commit is contained in:
Barney Carroll 2016-08-22 11:27:42 +01:00
parent 435b729289
commit db45260dbc

View file

@ -98,6 +98,8 @@ module.exports = function($window) {
initLifecycle(vnode.tag, vnode, hooks) initLifecycle(vnode.tag, vnode, hooks)
vnode.instance = Vnode.normalize(vnode.tag.view.call(vnode.state, vnode)) vnode.instance = Vnode.normalize(vnode.tag.view.call(vnode.state, vnode))
if (vnode.instance != null) { if (vnode.instance != null) {
if(vnode.instance === vnode)
throw Error("A component view mustn't return the vnode that was supplied to it.")
var element = createNode(vnode.instance, hooks, ns) var element = createNode(vnode.instance, hooks, ns)
vnode.dom = vnode.instance.dom vnode.dom = vnode.instance.dom
vnode.domSize = vnode.dom != null ? vnode.instance.domSize : 0 vnode.domSize = vnode.dom != null ? vnode.instance.domSize : 0