@@ -65,18 +65,17 @@ export function useModel(
6565 return
6666 }
6767 const rawProps = i . vnode ! . props
68- if (
69- ! (
70- rawProps &&
71- // check if parent has passed v-model
72- ( name in rawProps ||
73- camelizedName in rawProps ||
74- hyphenatedName in rawProps ) &&
75- ( `onUpdate:${ name } ` in rawProps ||
76- `onUpdate:${ camelizedName } ` in rawProps ||
77- `onUpdate:${ hyphenatedName } ` in rawProps )
78- )
79- ) {
68+ const hasVModel = ! ! (
69+ rawProps &&
70+ // check if parent has passed v-model
71+ ( name in rawProps ||
72+ camelizedName in rawProps ||
73+ hyphenatedName in rawProps ) &&
74+ ( `onUpdate:${ name } ` in rawProps ||
75+ `onUpdate:${ camelizedName } ` in rawProps ||
76+ `onUpdate:${ hyphenatedName } ` in rawProps )
77+ )
78+ if ( ! hasVModel ) {
8079 // no v-model, local update
8180 localValue = value
8281 trigger ( )
@@ -88,9 +87,18 @@ export function useModel(
8887 // updates and there will be no prop sync. However the local input state
8988 // may be out of sync, so we need to force an update here.
9089 if (
91- hasChanged ( value , emittedValue ) &&
9290 hasChanged ( value , prevSetValue ) &&
93- ! hasChanged ( emittedValue , prevEmittedValue )
91+ ( ( hasChanged ( value , emittedValue ) &&
92+ ! hasChanged ( emittedValue , prevEmittedValue ) ) ||
93+ // #13524: browsers differ in when they flush microtasks between
94+ // event listeners. If a v-model listener emits an intermediate value
95+ // and a following listener restores the model to its previous prop
96+ // value before parent updates are flushed, the parent render can be
97+ // deduped as having no prop change. Force a local update so DOM state
98+ // such as an input's value is synchronized back to the current model.
99+ ( hasVModel &&
100+ prevSetValue !== EMPTY_OBJ &&
101+ ! hasChanged ( emittedValue , localValue ) ) )
94102 ) {
95103 trigger ( )
96104 }
0 commit comments