-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MdAutocompleteTrigger writeValue is asynchronous #3250
Labels
area: material/autocomplete
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Comments
jelbourn
changed the title
MdAutocompleteTrigger is asynchronous
MdAutocompleteTrigger writeValue is asynchronous
May 1, 2017
@kara why is this async? |
crisbeto
added
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
has pr
labels
Jan 27, 2018
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Jan 27, 2018
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes angular#3250.
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Feb 3, 2018
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes angular#3250.
jelbourn
pushed a commit
that referenced
this issue
Feb 12, 2018
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes #3250.
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Mar 11, 2018
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes angular#3250.
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Apr 8, 2018
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes angular#3250.
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
May 7, 2018
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes angular#3250.
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
May 20, 2018
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes angular#3250.
mmalerba
pushed a commit
that referenced
this issue
May 24, 2018
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes #3250.
andrewseguin
pushed a commit
that referenced
this issue
Jun 7, 2018
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes #3250.
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Jun 29, 2018
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes angular#3250.
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Jul 11, 2018
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes angular#3250.
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Jul 16, 2018
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes angular#3250.
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Aug 24, 2018
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes angular#3250.
jelbourn
pushed a commit
that referenced
this issue
Aug 25, 2018
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes #3250.
vivian-hu-zz
pushed a commit
that referenced
this issue
Oct 3, 2018
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes #3250.
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Nov 23, 2018
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes angular#3250.
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Mar 30, 2019
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes angular#3250.
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Jul 8, 2019
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes angular#3250.
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Oct 12, 2020
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes angular#3250.
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Mar 2, 2022
Refactors the `MatAutocompleteTrigger.writeValue` method to avoid having to use a `Promise.resolve` to defer rendering. This makes it easier to test and avoids potential race conditions. It seems like the reason it was added in the first place was to be able to handle components that have a preselected value through a `FormControl` as well as a custom `displayWith` function. Fixes angular#3250.
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area: material/autocomplete
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Bug, feature request, or proposal:
Request for change (RFC)
What is the expected behavior?
The MdAutocompleteTrigger writeValue ValueAccesor method should be synchronous.
What is the current behavior?
The MdAutocompleteTrigger writeValue ValueAccesor method is asynchronous.
What are the steps to reproduce?
Simply implement the autocomplete and try to detect a change being reflected within the view upon updating the
formControl
throughsetValue
.Doing this requires a
setTimeout
coupled with wrapping the body of theit
statement withasync(() => { ... })
when writing unit tests. If you wish to detect the change being relayed to the inputvalue
.This is caused by the fact that (I assume) the writeValue wraps the
_setTriggerValue
method in aPromise.resolve(...)
: https://github.com/angular/material2/blob/master/src/lib/autocomplete/autocomplete-trigger.ts#L179What is the use-case or motivation for changing an existing behavior?
The motivation for this RFC is the fact that it complicates testing. If their are valid reasons to make the autocomplete trigger asynchronous then that's fine, but the documentation should reflect this fact.
Which versions of Angular, Material, OS, browsers are affected?
2.0.0-beta.2
The text was updated successfully, but these errors were encountered: