hyperapp: oncreate appears to be broken
OnCreate seems to be broken currently. When porting a rather large application from hyperapp@0.7
to hyperapp@0.9
I experienced a crash.
Broken Code [run]
const { h, app } = hyperapp
/** @jsx h */
app({
state: null,
actions: {
bug: element => element
},
view: (element, {bug}) => <h1 oncreate={bug}>{element ? 'yes' : 'no'}</h1>
})
Workaround [run]
const { h, app } = hyperapp
/** @jsx h */
app({
state: null,
actions: {
bug: element => element
},
view: (element, {bug}) => <h1 oncreate={data => setTimeout(() => bug(data), 0)}>{element ? 'yes' : 'no'}</h1>
})
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 29 (17 by maintainers)
@jbucaran No, I don’t have time for OpenSource stuff right now. I’m working while being a full-time student.
@jbucaran Sorry to quote myself again, but please re-read my last comment.
yeah. if you’re storing refs in some persistent state which can outlive the removal of the dom element. you gotta remember to de-ref the ref in your state during onRemove or whatever to let it get cleaned up.