Vuetify: [Bug Report] Infinite loop with v-autocomplete

Created on 28 Oct 2019  路  3Comments  路  Source: vuetifyjs/vuetify

Environment

Vuetify Version: 2.1.7
Vue Version: 2.6.10
Browsers: Chrome 77.0.3865.120
OS: Windows 10

Steps to reproduce

Create an autocomplete and set its items to an array of objects as a result of a search.

Expected Behavior

The search method should be called once

Actual Behavior

Its is called infinitely

Reproduction Link

https://codepen.io/Alex83690/pen/RwwZGvL

Other comments

To avoid this problem, the event "@update:search-input" must not be triggered when the input changes because the user has selected an option

VAutocomplete bug has workaround

All 3 comments

The temporary solution that I use and that I do not like:

search(term) {
    let match =   this.item && this.selected ? this.items.find((item) => { return item.id === this.selected }) : null
    if((match && match.text === term) || typeof term !== 'string' || term.trim() === '') {
        return
    }

    // Start the search
}

A simpler workaround is to use :search-input.sync and set a watcher on the data property instead of using the update method directly.

I've been struggling with this error for about 3 hours now 馃槙
And I can't find a workaround that solves my problem

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gluons picture gluons  路  3Comments

chriswa picture chriswa  路  3Comments

SteffenDE picture SteffenDE  路  3Comments

paladin2005 picture paladin2005  路  3Comments

dohomi picture dohomi  路  3Comments