Inconsistent tags behaviour with 1 item vs many #936

weepy opened this Issue Jul 8, 2015 · 3 comments


None yet

3 participants

weepy commented Jul 8, 2015

I have an XY component

<cursor each={ data in cursors } ></cursor>

If I mount my tag with 1 item in an array:

riot.mount("xy", {
    cursors:  [{}]

then this.tags.cursor is a single cursor item

If I mount with cursor: [{}, {}] then this.tags.cursor in an array (expected behaviour)

Is this a bug or a feature ?


rsbondi commented Jul 8, 2015

This is the expected behavior. It is a trade off, easier if you use single instance to do this.tagname, and also meaningful for multiple tags that are not in a loop, but I can see where it is counter intuitive in a loop. So you would need to check if it is an array and handle accordingly.

@rsbondi rsbondi added the question label Jul 8, 2015
weepy commented Jul 8, 2015

Perhaps this is part of the implementation, but it seems easy to reason that it should be an array if it was declared via "each" ?

@GianlucaGuarini GianlucaGuarini added this to the 3.0.0 milestone Feb 14, 2016

This issue is fixed in riot@3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment