sagalbot / vue-select

Everything you wish the HTML <select> element could do, wrapped up into a lightweight, extensible Vue component.
https://vue-select.org
MIT License
4.62k stars 1.33k forks source link

Options not updating #1700

Closed keizah7 closed 1 year ago

keizah7 commented 1 year ago

For unknown reason select stops updating options even vue dev tools shows that options is changing.

It's shows that where is no options, when it is some.. Why?

console.log prints new data, but select isn't showing options

image image image

<template>
<div>
    <v-select
        v-model="value"
        :options="options"
        :placeholder="placeholder"
        label="title"
        @search="onSearch">
    </v-select>
</div>
</template>
...

        onSearch (search) {
            if (search.length) {
                this.search(search, this);
            }
        },
        search: _.debounce((search, vm) => {
            const autocomplete = new google.maps.places.AutocompleteService()
                .getQueryPredictions({ input: search }, (predictions, status) => {
                    if (status != google.maps.places.PlacesServiceStatus.OK || !predictions) {
                        return;
                    }

                    let data = [];

                    predictions.forEach((prediction) => {
                        data.push({
                            id: prediction.place_id,
                            title: prediction.description,
                        });
                    });

                   console.log(data);
                    vm.options = data;
                });
        }, 1000),

https://user-images.githubusercontent.com/49227202/197552521-c9ef4261-7d60-4813-a850-aaf4e76401fc.mov

https://user-images.githubusercontent.com/49227202/197552695-48a736f6-b1d3-47a7-833a-9f8d7318fab2.mov

sagalbot commented 1 year ago

Can you post a full reproduction link that I can look at?

keizah7 commented 1 year ago

Thank you! Looks like filterable property solved my problem

https://vue-select.org/guide/ajax.html#disabling-filtering