vue-select icon indicating copy to clipboard operation
vue-select copied to clipboard

Error in getter for watcher "filteredOptions": "TypeError: Cannot read properties of null (reading 'concat')"

Open lubeHub opened this issue 3 years ago • 2 comments

I get error app.js:107129 [Vue warn]: Error in getter for watcher "filteredOptions": "TypeError: Cannot read properties of null (reading 'concat')" whenever I navigate to page with v-select from another page. After that, I reload page (F5) and the error is gone and v-select works normally.

` "

                                       <v-select
                                                option:deselected="deselectedValue()"
                                                :options="podaci"
                                                label="name"
                                                v-model="fields[number]"
                                                :selectable="
                                                    option =>
                                                        !checkIfExist(
                                                            option.name
                                                        )
                                                "
                                                @input="
                                                    setSelectedValue(
                                                        $event,
                                                        number
                                                    )
                                                "
                                            >`

Variable podaci is object.

I am using Opera on Windows 10.

lubeHub avatar Dec 02 '21 18:12 lubeHub

The same for me

apavelm avatar May 18 '22 11:05 apavelm

I know this is 7 months late, I've just been getting the same issue but I think I've found what was causing it.

Is there a point on first clean load where podaci is null? I notice you dont have a v-if using podaci so it will throw an error when it first loads the component.

I was setting the default value of my options as null and after fetching data for vselect it would load correctly with those errors thrown in console. After setting the default value to [] it was no longer throwing that error.

So as a workaround in place of null value handling within the vselect

  • either set default value of options variable as [] or
  • use v-if and check if options variable is not null before loading it

Brownyman avatar Jul 22 '22 19:07 Brownyman

The same for me

ramazansancar avatar Oct 25 '22 06:10 ramazansancar

The options prop requires an array - supplying anything else will trigger that error.

sagalbot avatar Nov 07 '22 00:11 sagalbot

Sometimes (while data is loading) for complex data structures it could be null or undefined. It would be nice if it will be considered as [] inside vue-select. @sagalbot

apavelm avatar Nov 07 '22 03:11 apavelm