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.

[Bug Report] @click:clear in a v-autocomplete cleareable sets the value to undefined always

See original GitHub issue

Versions and Environment

Vuetify: 1.3.9 Vue: 2.5.17 Browsers: Chrome 70.0.3538.102 OS: Windows 8.1

Steps to reproduce

Select an option in the autocomplete, then click the clear button

Expected Behavior

you should see that selectedID is null

Actual Behavior

selectedID is undefined

Reproduction Link

https://codepen.io/anon/pen/mQLdJZ

Other comments

It works OK if you use :clear-icon-cb="()=>selectedID=null" but in console you say is deprecated

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

18reactions
Webificommented, Jan 21, 2020

I completly agree with @arcreative.

“null” is a proper state. Undefined is not. In JavaScript, undefined will essentially remove the referenced property. I’d argue that undefined is not the correct state for the vast majority of use cases.

There’s no reason not to allow null values to be selected and also allow “clear” to default to null, but have the edge case where people want a clearable select list for a list containing a null to be forced to use the $nextTick(()=>object.value=undefined) hack to set to undefined.

I will strongly argue that setting a value to null on clear is NOT an edge case.

12reactions
romuccicommented, Apr 12, 2019

Any updates on this? Would be really awesome for it to be set to null rather than undefined.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vuetify's v-autocomplete component resets the v-model value ...
The problem I'm facing is that when the text typed in the v-autocomplete is cleared, select defaults to null instead of an empty...
Read more >
How To Change The Behavior Of Clicking An Option Item Of V ...
[Bug Report] @click:clear in a vautocomplete cleareable sets the value to undefined always #5722. Closed. empresarrollo opened this issue.
Read more >
Text fields - Material Component Framework — Vuetify.js
Configures the default <input> autocomplete attribute. Name. clear-icon. Default. '$vuetify.icons.clear'. Type. string. Applied when using clearable and the ...
Read more >
Text field component — Vuetify.js
When hide-details is set to auto messages will be rendered only if there's a message (hint, error message, counter value etc) to display....
Read more >
bug.report function - RDocumentation
A character vector describing the location of R library trees in which to search for the package, or NULL . The default value...
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