Skip to content

Unable to use multiple autoruns in two diffirent computed functions #37

Open
@canveed

Description

@canveed

I was trying to use this code:

  computed:{
        messages(){
            let self = this;

            if(this.$subReady.messages){
                console.log(Meteor.user().username + " and " + self.link);
                return this.$autorun(function() {
                    Meteor.call("setCheckedDuo", {"opponent": self.link, "id": Meteor.userId()})
                    return Messages.find({}, {
                        sort: { created: this.sort ? -1 : 1 },
                    })})
            }
        },
        opponentOnline(){
            if(this.$subReady.userStatus){
                return this.$autorun(() => {
                    return "testing"
                })
            }

        }

    },`

But it starts loop and send about 500-600 request to the server. If i will just remove opponentOnline function or messages function, everything will work as should be. How to fix this? I've tried to remove node_modules and download again, nothing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions