Vue.js render() and $slots; Corrupt DOM

Just ran into an issue today when making a component with a custom render() function and messing around with vnodes passed in via $slots. A seemingly simple template produced really odd results where some DOM elements would disappear, some would be duplicated, some would be out of order, and others would have their inner content ripped out to their outside after a few rerenders. Small template tweaks would also produce vastly different output, sometimes seemingly correct output.

You can see an example in this codepen:

See the Pen Vue.js $slots with and without v-bind:key by Peter “Cobertos” F. (@cobertos) on CodePen.

Powered by Hexo Logo Fursona by TFOTR