Maquette cannot read property "class" of undefined

47 Views Asked by At

Chrome debug console snapshot

I basically am unsure as to what is causing this error ^^.

I've done a little digginng, and it seemse the previousProperties is passed in as previous.properties by updateDom(). previous, in turn, is passed in by update where it is labeled as just vnode. This VNOde is a valid VNode, but just lacks the properties.

I'm pretty sure I've made everything distinguishable (by setting unique key properties) that would need to be distinguishable, so I don't think that's the problem, although I could be mistaken.

1

There are 1 best solutions below

0
On

So I had this question, wrote it, did more looking and found my answer before even posting it. I'm still posting this question, and answering it myself in hopes that it might help save someone else some heartache in the future.

In this case, this error is being caused by a projector rendering and receiving an invalid value in return from the renderMaquette function. In my component based framework, I've been using ternary operators to work like if-else statements inside renderMaquetteFunction return blocks. I.E.

function renderMaquette(){
    return h('div',
        showTitle ? 
            h('h1', 'My Title')
        : []
    )
}

Leaving an empty array is perfectly acceptable parameter inside of a hyperscript function, as it will return nothing. However, returning an empty array is not. I.E.

function renderMaquette(){
    return showTitle ? 
            h('h1', 'My Title')
        : []
}

This generates an error.