meteor-vue / vue-meteor-tracker

Use Meteor Tracker reactivity inside Vue components
90 stars 20 forks source link

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

Open canveed opened 6 years ago

canveed commented 6 years ago

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.