@@ -39,8 +39,8 @@ export class NgrxFormControlDirective<TValue extends FormControlValueTypes> impl
3939 }
4040
4141 if ( this . state && newState . id !== this . state . id ) {
42- this . valueWasReported = false ;
43- this . lastReportedViewValue = undefined as any ;
42+ this . viewValueIsKnown = false ;
43+ this . viewValue = undefined as any ;
4444 }
4545
4646 this . state = newState ;
@@ -72,8 +72,8 @@ export class NgrxFormControlDirective<TValue extends FormControlValueTypes> impl
7272 // types something the cursor is forced to the end of the input; to prevent this
7373 // behavior we compare the last reported value with the value to be set and filter out
7474 // those values that are equal to the last reported value
75- private valueWasReported : boolean ;
76- private lastReportedViewValue : TValue ;
75+ private viewValueIsKnown : boolean ;
76+ private viewValue : TValue ;
7777
7878 constructor (
7979 private el : ElementRef ,
@@ -95,8 +95,8 @@ export class NgrxFormControlDirective<TValue extends FormControlValueTypes> impl
9595 this . valueAccessor . registerOnChange ( ( newValue : TValue ) => {
9696 newValue = this . convertViewValue ( newValue ) ;
9797 if ( newValue !== this . state . value ) {
98- this . valueWasReported = true ;
99- this . lastReportedViewValue = newValue ;
98+ this . viewValueIsKnown = true ;
99+ this . viewValue = newValue ;
100100 this . actionsSubject . next ( new SetValueAction ( this . state . id , newValue ) ) ;
101101 }
102102 } ) ;
@@ -109,11 +109,13 @@ export class NgrxFormControlDirective<TValue extends FormControlValueTypes> impl
109109
110110 this . subscriptions . push (
111111 this . state$
112- . map ( s => ( { id : s . id , value : this . convertModelValue ( s . value ) } ) )
113- . distinctUntilChanged ( ( l , r ) => l . id === r . id && l . value === r . value )
114- . map ( s => s . value )
115- . filter ( v => ! this . valueWasReported || v !== this . lastReportedViewValue )
116- . subscribe ( value => this . valueAccessor . writeValue ( value ) )
112+ . map ( s => this . convertModelValue ( s . value ) )
113+ . filter ( v => ! this . viewValueIsKnown || v !== this . viewValue )
114+ . subscribe ( value => {
115+ this . valueAccessor . writeValue ( value ) ;
116+ this . viewValueIsKnown = true ;
117+ this . viewValue = value ;
118+ } )
117119 ) ;
118120
119121 if ( this . valueAccessor . setDisabledState ) {
0 commit comments