Bug with each={ ... } on server side #1628

Closed
ilearnio opened this Issue Feb 26, 2016 · 2 comments

Projects

None yet

2 participants

@ilearnio

I'm using riot.render to perform server side rendering. I was needed to loop through a list of my users using each={ users } but it throws an error on the server side. On the client, it is working fine.

Example https://tonicdev.com/artnikpro/riot-bug

@GianlucaGuarini
Member

you forgot the quotes:

riot.tag('some-tag', `
    <ul each="{ users }">
        <li>{ username }</li>
    </ul>
`, {}, () => {
    this.users = [
        { username: 'me' },
        { username: 'john' }
    ]
})
@ilearnio

Oh, it seems that I should have provided table instead of ul like I have in my actual project's code. It seems that the error occurs only when I use tables, with uls it works fine

I have updated the example, please have a look. Now it shows the exact same error as in my project

TypeError: Cannot read property 'length' of undefined
@GianlucaGuarini GianlucaGuarini added fixed and removed to verify labels Feb 27, 2016
@GianlucaGuarini GianlucaGuarini added a commit that closed this issue Feb 27, 2016
@GianlucaGuarini GianlucaGuarini closes #1628 86b7a22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment