When an event handler of a tag gets triggered, Riot currently calls the update() method automatically. Depending on the use case, this might actually not be desirable, for instance when listening to an onkeyup event like so:
<paragraphs-tag>
{console.log("this will be rerendered with every keystroke in the input field")}
<p each={paragraph in self.paragraphs}>
{paragraph}
</p>
<input onkeyup="keyhandler" />
<script>
keyhandler(e) {
//it would be nice if there was a way to decide
//here whether updating the view is necessary
}
</script>
</paragraphs-tag>
Have you tried e.preventUpdate = true? https://muut.com/riotjs/guide/#tag-lifecycle
Thanks a bunch! Maybe it would be a good idea to highlight the existence of e.preventUpdate simply by using the code format on it so that it can be found more easily while scanning the documentation for information.
shouldn't be e.preventUpdate = true be e.preventUpdate() like e.preventDefault() and e.preventPropagate is implemented in the standards?
More info would be awesome regarding this decision. Thanks in advance @GianlucaGuarini !
Most helpful comment
Thanks a bunch! Maybe it would be a good idea to highlight the existence of e.preventUpdate simply by using the
codeformat on it so that it can be found more easily while scanning the documentation for information.