@@ -161,35 +161,39 @@ export default {
161161 if ( lazy && ! force ) {
162162 return
163163 }
164- value = this . modifyValue ( value )
165- if ( value !== this . vModelValue ) {
166- this . clearDebounce ( )
167- const doUpdate = ( ) => {
164+ // Make sure to always clear the debounce when `updateValue()`
165+ // is called, even when the v-model hasn't changed
166+ this . clearDebounce ( )
167+ // Define the shared update logic in a method to be able to use
168+ // it for immediate and debounced value changes
169+ const doUpdate = ( ) => {
170+ value = this . modifyValue ( value )
171+ if ( value !== this . vModelValue ) {
168172 this . vModelValue = value
169173 this . $emit ( 'update' , value )
174+ } else if ( this . hasFormatter ) {
175+ // When the `vModelValue` hasn't changed but the actual input value
176+ // is out of sync, make sure to change it to the given one
177+ // Usually caused by browser autocomplete and how it triggers the
178+ // change or input event, or depending on the formatter function
179+ // https://github.com/bootstrap-vue/bootstrap-vue/issues/2657
180+ // https://github.com/bootstrap-vue/bootstrap-vue/issues/3498
181+ /* istanbul ignore next: hard to test */
182+ const $input = this . $refs . input
183+ /* istanbul ignore if: hard to test out of sync value */
184+ if ( $input && value !== $input . value ) {
185+ $input . value = value
186+ }
170187 }
171- const debounce = this . computedDebounce
172- // Only debounce the value update when a value greater than `0`
173- // is set and we are not in lazy mode or this is a forced update
174- if ( debounce > 0 && ! lazy && ! force ) {
175- this . $_inputDebounceTimer = setTimeout ( doUpdate , debounce )
176- } else {
177- // Immediately update the v-model
178- doUpdate ( )
179- }
180- } else if ( this . hasFormatter ) {
181- // When the `vModelValue` hasn't changed but the actual input value
182- // is out of sync, make sure to change it to the given one
183- // Usually caused by browser autocomplete and how it triggers the
184- // change or input event, or depending on the formatter function
185- // https://github.com/bootstrap-vue/bootstrap-vue/issues/2657
186- // https://github.com/bootstrap-vue/bootstrap-vue/issues/3498
187- /* istanbul ignore next: hard to test */
188- const $input = this . $refs . input
189- /* istanbul ignore if: hard to test out of sync value */
190- if ( $input && value !== $input . value ) {
191- $input . value = value
192- }
188+ }
189+ // Only debounce the value update when a value greater than `0`
190+ // is set and we are not in lazy mode or this is a forced update
191+ const debounce = this . computedDebounce
192+ if ( debounce > 0 && ! lazy && ! force ) {
193+ this . $_inputDebounceTimer = setTimeout ( doUpdate , debounce )
194+ } else {
195+ // Immediately update the v-model
196+ doUpdate ( )
193197 }
194198 } ,
195199 onInput ( evt ) {
0 commit comments