Raynos / mercury

A truly modular frontend framework
http://raynos.github.io/mercury/
MIT License
2.82k stars 143 forks source link

Banning transient state by default #73

Open Raynos opened 10 years ago

Raynos commented 10 years ago

Currently mercury allows transient state.

i.e. h('input') where you don't specify the value for the input and allow that state to live in the DOM as a mutable value.

This may cause subtle bugs like a virtual-dom diff / patch cycle not resetting the value to the empty string because it was left transient.

This is either a "feature" or a "bug".

One solution is to have mercury throw an exception if the user "accidentally" uses transient state and to make transient state opt in with something like h('input', { value: h.TRANSIENT })

Raynos commented 10 years ago

cc @Matt-Esch

jxson commented 10 years ago

The subtleties here seem like it would be better to have mercury throw in this case. I think most who get into this situation would probably get there on accident...