vue-meteor-tracker icon indicating copy to clipboard operation
vue-meteor-tracker copied to clipboard

Unable to use multiple autoruns in two diffirent computed functions

Open canveed opened this issue 7 years ago • 0 comments
trafficstars

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.

canveed avatar Aug 01 '18 12:08 canveed