Riot.js Bug Report Template

by gianlucaguarini

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/riot/2.6.3/riot+compiler.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/riot/2.6.5/riot+compiler.js"></script>
<app></app>

<script type="riot/tag">
    <partial>
    		<span>{JSON.stringify(opts.obj)}</span>
        this.on('unmount', () => console.log(`unmounted ${JSON.stringify(opts.obj)}`))
    </partial>
    <app>
    		<!-- (1) Doing it this way causes the partial to be unmounted immediately -->
        <div each={o in this.objects} style="min-height: 1em; background-color: aqua;">
            <partial obj="{o}" />
        </div>

				<!-- (2) Doing it this way works: -->
        <div>
        		<partial each={o in objects} obj="{o}"/>
        </div>
        
        
        <button onclick={this.save}>Save</button>

        this.objects = [];
        this.newobj = {};

        this.save = () => {
        	this.newobj.pushed = true;
          this.objects.push(this.newobj);
          this.newobj = null;
          this.update();
        }
    </app>
</script>

CSS

body {
    font-family: sans-serif;
}

JavaScript

/**
 * Riot.js is loaded from External Resources
 * https://cdnjs.cloudflare.com/ajax/libs/riot/2.6.5/riot+compiler.js
 */
riot.mount('app')