question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't handle `undefined` value

See original GitHub issue

Hello, when value is set to undefined, the console show these messages:

vue.common.js?e881:1019 [Vue warn]: Error when evaluating expression "function (){return this.multiple?this.value.slice(0,this.limit):this.value}": TypeError: Cannot read property 'slice' of undefined (found in component: <multiselect>)warn @ vue.common.js?e881:1019Watcher.get @ vue.common.js?e881:3176Watcher.evaluate @ vue.common.js?e881:3356computedGetter @ vue.common.js?e881:8035(anonymous function) @ VM46429:3Watcher.get @ vue.common.js?e881:3173Watcher.run @ vue.common.js?e881:3314runBatcherQueue @ vue.common.js?e881:3071flushBatcherQueue @ vue.common.js?e881:3041nextTickHandler @ vue.common.js?e881:445
vue.common.js?e881:1019 [Vue warn]: Error when evaluating expression "multiple && max === value.length": TypeError: Cannot read property 'length' of undefined (found in component: <multiselect>)warn @ vue.common.js?e881:1019Watcher.get @ vue.common.js?e881:3176Watcher.run @ vue.common.js?e881:3314runBatcherQueue @ vue.common.js?e881:3071flushBatcherQueue @ vue.common.js?e881:3041nextTickHandler @ vue.common.js?e881:445
vue.common.js?e881:1019 [Vue warn]: Error when evaluating expression "!max || value.length < max": TypeError: Cannot read property 'length' of undefined (found in component: <multiselect>)

A simple check to convert undefined to an empty array could be an easy solution, no ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
shentaocommented, Aug 10, 2016

Thanks for more details! I will try to look into it this week! 😃

1reaction
shentaocommented, Feb 20, 2017

This will be fixed in beta.14 (already on master). Should be published tomorrow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot Read Property of Undefined in JavaScript - Rollbar
What Causes TypeError: Cannot Read Property of Undefined. Undefined means that a variable has been declared but has not been assigned a value....
Read more >
Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError: Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an undefined...
Read more >
7 Tips to Handle undefined in JavaScript - Dmitri Pavlutin
A detailed article about 'undefined' keyword in JavaScript. 7 tips on how to handle correctly 'undefined' and increase code durability.
Read more >
[Solved] Cannot read Properties of Undefined in JavaScript
The 'Cannot read properties of undefined' error occurs when you try to access a property or a method on a variable that stores...
Read more >
How to Avoid Getting 'Cannot read property of undefined' in ...
One of the most common type errors in JavaScript is the famous "Cannot read property of undefined". This error occurs when you try...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found