Closed maximilianschmitt closed 8 years ago
Hey there, thanks for opening this. Yeah, ran into this last week too. I think this is a bug in morphdom; it might be worth raising it there. Thanks!
i recently ran into this bug: https://github.com/Raynos/min-document/issues/42, related but only when you do tree.toString()
.
Thanks @yoshuawuyts. I tried to reproduce the issue with morphdom and bel but everything works as expected there:
'use strict'
const bel = require('bel')
const morphdom = require('morphdom')
window.value = 'hello'
const textarea = renderTextarea(window.value)
const button = renderButton()
document.body.appendChild(textarea)
document.body.appendChild(button)
function renderTextarea (value) {
return bel`<textarea oninput=${onInput}>${value}</textarea>`
function onInput (e) {
window.value = e.target.value
render()
}
}
function renderButton () {
return bel`<button onclick=${reset}>reset</button>`
function reset () {
window.value = ''
render()
}
}
function render () {
morphdom(textarea, renderTextarea(window.value))
}
Any other ideas what the issue might be here?
@maximilianschmitt a morphdom patch was released 18 hours ago (you posted it 10 hours ago) - maybs it got fixed?
Yes, works with newest morphdom thanks! :) can we expect an update to choo soon? :)
@maximilianschmitt the patch for morphdom
was published as a minor version so if you reinstall choo
(without cache) it should pop up there real nicely
@yoshuawuyts Thanks! Unfortunately this isn't working. I tried npm cache clear
and npm i choo --cache-min=0
but I'm getting morphdom@1.4.6
.
@maximilianschmitt oh damn, you're right - this is the issue https://github.com/maxogden/yo-yo/pull/44
morphdom@2.1.0
landed in https://github.com/maxogden/yo-yo/pull/51 - this should all be solved now! :sparkles:
Hm, I don't know if I'm doing something wrong, but the example above does NOT work for me (the reset button doesn't change the value of the textarea) with the latest Choo / yo-yo / morphdom:
emanchado@pankhurst:~/tmp/choo-bug$ npm ls choo
/home/emanchado/tmp/choo-bug
└── choo@3.3.0
emanchado@pankhurst:~/tmp/choo-bug$ npm ls yo-yo
/home/emanchado/tmp/choo-bug
└─┬ choo@3.3.0
└── yo-yo@1.3.0
emanchado@pankhurst:~/tmp/choo-bug$ npm ls morphdom
/home/emanchado/tmp/choo-bug
└─┬ choo@3.3.0
└─┬ yo-yo@1.3.0
└── morphdom@2.1.2
emanchado@pankhurst:~/tmp/choo-bug$ node --version
v6.2.1
No feedback, no JavaScript error on the console... Any ideas?
@emanchado odd, yeah can confirm. Still seems like a morphdom
issue - would you mind raising it there?
edit: requirebin link
@yoshuawuyts did you see this? https://github.com/patrick-steele-idem/morphdom/issues/88#issuecomment-252784028 Should I open a yo-yo issue instead?
@emanchado yeah reckon that might be good
I've modified the getting started code to keep it as minimal as possible:
Expected behavior
When I click reset, I'm expecting the textarea's value to be an empty string:
Actual behavior
Steps to reproduce behavior
Use this code to get the buggy application to work:
Add
value=${state.title}
to thetextarea
to get the desired behaviour.