File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -178,9 +178,14 @@ export class MatChipRow extends MatChip implements AfterViewInit {
178
178
// The value depends on the DOM so we need to extract it before we flip the flag.
179
179
const value = this . value ;
180
180
181
- this . _isEditing = true ;
182
- this . _editStartPending = true ;
181
+ this . _isEditing = this . _editStartPending = true ;
183
182
183
+ // Starting the editing sequence below depends on the edit input
184
+ // query resolving on time. Trigger a synchronous change detection to
185
+ // ensure that it happens by the time we hit the timeout below.
186
+ this . _changeDetectorRef . detectChanges ( ) ;
187
+
188
+ // TODO(crisbeto): this timeout shouldn't be necessary given the `detectChange` call above.
184
189
// Defer initializing the input so it has time to be added to the DOM.
185
190
setTimeout ( ( ) => {
186
191
this . _getEditInput ( ) . initialize ( value ) ;
@@ -189,8 +194,7 @@ export class MatChipRow extends MatChip implements AfterViewInit {
189
194
}
190
195
191
196
private _onEditFinish ( ) {
192
- this . _isEditing = false ;
193
- this . _editStartPending = false ;
197
+ this . _isEditing = this . _editStartPending = false ;
194
198
this . edited . emit ( { chip : this , value : this . _getEditInput ( ) . getValue ( ) } ) ;
195
199
196
200
// If the edit input is still focused or focus was returned to the body after it was destroyed,
You can’t perform that action at this time.
0 commit comments