[Bug Report] @click:clear in a v-autocomplete cleareable sets the value to undefined always
See original GitHub issueVersions 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:
- Created 5 years ago
- Reactions:6
- Comments:13 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
Any updates on this? Would be really awesome for it to be set to null rather than undefined.