fritx / vue-at

At.js for Vue.
https://fritx.github.io/vue-at/
MIT License
529 stars 114 forks source link

BUG? @at event called 2 times #65

Open gmatkowski opened 6 years ago

gmatkowski commented 6 years ago

There is a bug when @at event is being called 2 times on every new character. <at-ta at="#" :allowSpaces="false" :members="members" @at="handleAt">

image

fritx commented 6 years ago

@gmatkowski ahh.. let me have a look. Btw, which browser and version are you using?

gmatkowski commented 6 years ago

Chrome 66.0.3359.181, vue-at @ 2.5.0-beta

gmatkowski commented 6 years ago

green line i incorrect, not the same time.

fritx commented 6 years ago

@gmatkowski oh i'm sorry the bug does exist!

gmatkowski commented 6 years ago

Hope you can fix it :-)

phh commented 6 years ago

Created a quickfix for my own app until this has been fixed:

data() {
    return {
        atSearch: '',
    }
}

...

handleAt: function(chunk) {
    // See https://github.com/fritx/vue-at/issues/65
    if (this.atSearch === chunk) {
        return;
    }

    this.atSearch = chunk;

    ...
},

This still calls handleAt twice, but prevents it from doing more logic in the actual method.