Hyperapp: Undefined Parameter Causes Crash

Created on 16 Feb 2017  路  8Comments  路  Source: jorgebucaran/hyperapp

Broken Code

const { h, app } = hyperapp
/** @jsx h */

const Example = ({a}) =>
    <div>
        Item {a}
    </div>

app({ 
    model: "Hi.", 
    view: model => <div><Example/>this should always render</div>
})

TypeError: undefined is not an object (evaluating 'node.data')

Working Code

const { h, app } = hyperapp
/** @jsx h */

const Example = ({a}) =>
    <div>
        Item {a}
    </div>

app({ 
    model: "Hi.", 
    view: model => <div><Example a=""/>this should always render</div>
})

Again, I'm not sure if this is intentional or a bug. Might be nice to show a better error if the ENV isn't production in case this is intended.

Bug

Most helpful comment

Btw reference https://facebook.github.io/react/docs/jsx-in-depth.html#booleans-null-and-undefined-are-ignored

All 8 comments

@dodekeract Couldn't repro. Both work fine. Neither one render anything.

It would help if you could provide broken examples via a CodePen/Fiddle.

Okay, then the issue is weirder than I expected. I updated the original comment with links.

@dodekeract Thanks! I'll look into this. 馃挭

@dodekeract Fortunately this is somewhat related to https://github.com/hyperapp/hyperapp/issues/92, so fixing this might kill two birds with one stone.

Btw reference https://facebook.github.io/react/docs/jsx-in-depth.html#booleans-null-and-undefined-are-ignored

@tunnckoCore Thanks, that's really useful. I was looking just for that a couple of days ago.

@tunnckoCore thanks for sharing, wasn't aware of the .length "bug"/issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jorgebucaran picture jorgebucaran  路  4Comments

zhaotoday picture zhaotoday  路  3Comments

zaceno picture zaceno  路  3Comments

VictorWinberg picture VictorWinberg  路  3Comments

ghost picture ghost  路  3Comments