Undefined Parameter Causes Crash
See original GitHub issueBroken 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.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Undefined query parameters causes crash · Issue #55 - GitHub
If you pass an undefined value as a parameter to a query it crashes when trying to bind. Unfortunately with a stack trace...
Read more >Node JS preventing value undefined crash - Stack Overflow
I have a value that is determined by the user and once that value is entered it checks the corresponding value of that...
Read more >How to Prevent the Error: Cannot Read Property '0' of Undefined
A guide on how to prevent the error "cannot Read Property '0' of Undefined", covering techniques such as try, catch, using const over...
Read more >805034 – accessing an undefined variable might cause crash
Cause: When an LDAP entry changed its attributes and was saved again into the SSSD cache, the SSSD might have accessed an undefined...
Read more >Diagnosing memory, thread, and crash issues early
Code that results in undefined behavior can lead to crashes or incorrect output. In some cases, the code may not result in any...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Btw reference https://facebook.github.io/react/docs/jsx-in-depth.html#booleans-null-and-undefined-are-ignored
@dodekeract Fortunately this is somewhat related to https://github.com/hyperapp/hyperapp/issues/92, so fixing this might kill two birds with one stone.