-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Setting Collapse component display input does not work #6070
Labels
Comments
marcinmajkowski
added a commit
to marcinmajkowski/ngx-bootstrap
that referenced
this issue
Apr 24, 2021
This change removes race conditions caused by TypeScript setters being called by Angular in non-deterministic order. Setters side effects (reading values set in other setters) are moved to ngOnChanges lifecycle hook. The consequence is that those side effects are no longer called when those inputs are set other than in the template. This is a breaking change but methods to call instead of setting those properties are already provided (show/hide) so migration path is straightforward. Setting display to 'none' no longer hides the collapse, setting collapse input to true or calling hide method is the way to go. BREAKING CHANGE: setting display or collapse property on CollapseDirective no longer expands/collapses the collapse - use show/hide methods instead or set collapse input in template
marcinmajkowski
added a commit
to marcinmajkowski/ngx-bootstrap
that referenced
this issue
Apr 24, 2021
This change removes race conditions caused by TypeScript setters being called by Angular in non-deterministic order. Setters side effects (reading values set in other setters) are moved to ngOnChanges lifecycle hook. The consequence is that those side effects are no longer called when those inputs are set other than in the template. This is a breaking change but methods to call instead of setting those properties are already provided (show/hide) so migration path is straightforward. Setting display to 'none' no longer hides the collapse, setting collapse input to true or calling hide method is the way to go. BREAKING CHANGE: setting display or collapse property on CollapseDirective no longer expands/collapses the collapse - use show/hide methods instead or set collapse input in template
@SvetlanaMuravlova, I am not sure whether #6257 fixes the issue reliably. There is still the same problem in the code - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug description
Collapse directive has
display
input but setting its value to e.g.'flex'
does not change display of collapse host - directive still sets it toblock
.Reproduction
https://stackblitz.com/edit/angular-hw6kgm?file=app/basic.html
In reproduction,
display
is set to'flex'
however directive keeps settingstyle="display: block;"
.Additional information
This seem to be related to using TypeScript
set
(setters) for triggering side effects (instead of doing it "Angular way" usingngOnChanges
) - there seem to be race conditions between multiple intputs (display
setter may be called before or afterisAnimated
input is set by the framework and the order seem to be not guaranteed - it even could change between Ivy and View Engine).The text was updated successfully, but these errors were encountered: