Vue-multiselect: Error in nextTick: "TypeError: Cannot read property 'focus' of undefined"

Created on 15 Apr 2019  路  8Comments  路  Source: shentao/vue-multiselect

I am getting following error when running automated tests on our app:
image
It's thrown because for some reason all $refs are undefined in this callback inside $nextTick:
https://github.com/shentao/vue-multiselect/blob/8c162dd01a4b0d85eb405d5c116b3f9080b612d1/src/multiselectMixin.js#L656

image

It might be related to the fact that there is a v-if on the multiselect component, as well as on the parent component (the issue seems to happen when those values change to false - the components are removed from DOM).

Possible fix would be to check if $refs.search is not undefined before calling focus() on it.

I tried to reproduce this on jsfiddle, but was unsuccessful.

Reproduction Link

None

Steps to reproduce

Hard to reproduce, as it happens only when running automated tests, and even then, only sometimes.

Expected behaviour

No error

Actual behaviour

Error present

needs repro

Most helpful comment

This is still issue. Using latest version of vue-multiselect

All 8 comments

Have simillar issue but with blur()
image

I'm also having a similar issue.
When I am typing into the input box, and then delete, if I hit the delete key one additional time, I get the same "TypeError: Cannot read property '$isDisabled' of undefined", as well as "Cannot read property 'blur' of undefined" any ETA on a fix?

Reproduction Link

https://jsfiddle.net/1e97k8pf/

Steps to reproduce

  1. click gotobar
  2. open the select dropdown
  3. click browser back button
  4. errors in console

This is still issue. Using latest version of vue-multiselect

The latest version is 2.1.6, it's still haven't included this fix yet.

https://github.com/shentao/vue-multiselect/blob/904d10fb1b/src/multiselectMixin.js#L658

As mentioned above, this is still a problem with the latest release @p-adams and it would be appropriate to reopen the ticket until it gets resolved. Are there any blockers for getting a new release out with the relevant changes?

having the same issue when opening the multiselect, then navigating via browser back button.

Still not in production, please help!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PrimozRome picture PrimozRome  路  3Comments

focussing picture focussing  路  3Comments

andreasvirkus picture andreasvirkus  路  3Comments

yaakovp picture yaakovp  路  3Comments

hskrishna29 picture hskrishna29  路  3Comments