-
Notifications
You must be signed in to change notification settings - Fork 6.8k
refactor(autocomplete): make keyboard and visibility calls synchronous #6441
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
Conversation
|
||
// Defer emitting to the stream until the next tick, because changing | ||
// bindings in here will cause "changed after checked" errors. | ||
return Promise.resolve(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mixing switchMap and Promise.resolve doesn't feel quite right. Use do
and observeOn(asap)
operators here instead? It would be more rx idiomatic.
5da9ee7
to
de700f1
Compare
@kara I've switch it to use |
de700f1
to
0d94a6b
Compare
0d94a6b
to
02bbe0e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, will need rebase.
02bbe0e
to
e0ea08e
Compare
fa2f980
to
37a0d19
Compare
@crisbeto Looks like a linter failure bc map is unused. Update? |
37a0d19
to
f13b84e
Compare
Fixed the linting error and a test failure. |
Reworks a few methods, that were changing the view in a `Promise.resolve`, to be synchronous. The initial idea behind deferring those calls was to avoid "changed after checked" errors, however they also make things harder to test. It seems like the root of the issue for all of them was that we were trying to modify view properties after the `options.changed` callback had fired, which comes after change detection. These changes have the advantage of making things a lot easier and cleaner to test, as well as making the API easier to use.
f13b84e
to
ff41770
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Reworks a few methods, that were changing the view in a
Promise.resolve
, to be synchronous. The initial idea behind deferring those calls was to avoid "changed after checked" errors, however they also make things harder to test. It seems like the root of the issue for all of them was that we were trying to modify view properties after theoptions.changed
callback had fired, which comes after change detection. These changes have the advantage of making things a lot easier and cleaner to test, as well as making the API easier to use.