b-input changes v-model from null to empty string on blur
See original GitHub issueDescribe the bug
By hydrating a b-input v-model with a null value and blurring the input with no changes, the object property is changed from null
to an empty string ""
. This happens only the first time when the input is hydrated. If you hydrate it again with no page refresh, it works as expected.
Steps to reproduce the bug
- Hydrate the
<b-input>
with anull
value for thev-model
- Focus the input
- Blur the input with no changes at all
- See how the property is changed from
null
to""
Expected behavior
The object property must still as null
Versions
Libraries:
- BootstrapVue: ~2.19.0
- Bootstrap: ~4.4.1
- Vue: ^2.6.12
Environment:
- Device: Desktop
- OS: Ubuntu 18
- Browser: Chrome
- Version: 86.0.4240.198 (Official Build) (64-bit)
Additional context
This is causing an issue with some 3rd party validators like vee-validate, where a pristine
flag is set to false
because changes were detected on the object (from null
to ""
).
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
vue.js - Avoid converting null to empty string on b-input blur
EDIT This is getting odd. The way I propagate the resource to local data in the component is by clicking an element from...
Read more >Vue-Multiselect | Vue Select Library
Useful for single selects that don't allow empty selection. Single select / dropdown. Select one.
Read more >Component Events | Vue.js
A component can emit custom events directly in template expressions (e.g. in a v-on handler) using the built-in $emit method: template
Read more >Vue form input validation using watchers - LogRocket Blog
Perform form validation in Vue using the watch option. Watchers are a great way to respond to data changes in a given element....
Read more >ion-input: Custom Input Value Type Styling and CSS Properties
Inputs offer two options for clearing the input based on how you interact with it. The first way is by adding the clearInput...
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
@lucianobosco Yeah 😃
@jackmu95 thanks! This is working as expected. Will this fix be included in the next release?