numtel/meteor-mysql

Subscription does not work in a loop

phibya opened this issue · 0 comments

In React, I have a page Account that has a MysqlSubscription named accounts
If I create a component Page with another MysqlSubscription name pages and send accountId parameter to it, then use a loop in page Account to render that page, the subscription in Page will not work. (the subscription in Account still works).

render(){
    return (
        this.data.accounts.map(({accountId})=>{
              <Page accountId={accountId} />
        })
    )
}

If I remove the loop like this:

render(){
    return (
        <Page accountId={1} />
    )
}

or use a static array:

render(){
    return (
        [{accountId: 1},{accountId: 2}].map(({accountId})=>{
              <Page accountId={accountId} />
        })
    )
}

the subscription will work again.