Skip to content
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

Typeahead doesnt work properly in component set to ChangeDetectionStrategy.OnPush #1177

Closed
slubowsky opened this issue Oct 28, 2016 · 5 comments

Comments

@slubowsky
Copy link

slubowsky commented Oct 28, 2016

If typeaheads are used in a component with changeDetection set to ChangeDetectionStrategy.OnPush the typeaheads dont behave properly. i.e. The UI is not always (e.g. on initial click) updated when the dropdown should be appearing. This problem only occurs when parent is set to ChangeDetectionStrategy.OnPush. When that is removed everything works as expected.

See #563 and its fix #566 which is likely exactly the same thing needed here. Perhaps call changeDetector.markForCheck() in both show() and hide()?

my work around for now is to call markForCheck whenever typeaheadLoading is fired :(

@valorkin
Copy link
Member

hm, had to check this out

@diegomaninetti
Copy link

Same behavior for RadioButton (btnRadio) directive.

@valorkin valorkin added the WIP label Jan 19, 2017
@olaf89
Copy link

olaf89 commented Mar 24, 2017

I had the same issue, im using redux for state management, so my typeahead data is just array and is being updated each time after user keys in,

The issue is when using on push strategy options are not updated, they are loaded but the visible options list is updated only after user type in.

so lets say user type in :
A
and loaded options are:
Ab
Abc
Abcd

They are hidden until he types in Ab.
at least that what it looks like.

After removal of onPush, it works fine.

@IlyaSurmay
Copy link
Contributor

Hi, could you reproduce this issue in plunkr/stackblitz?
You can use one of starter templates:
Plunkr: https://plnkr.co/edit/0NipkZrnckZZROAcnjzB?p=preview
StackBlitz: https://stackblitz.com/edit/ngx-bootstrap?file=app%2Fapp.module.ts

@slubowsky
Copy link
Author

@IlyaSurmay I no longer have this issue using 2.0.0-beta.8. I believe it was fixed for me at least some time ago but couldn't say exactly which version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants