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

fix(collapse): respect display input value #6071

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

marcinmajkowski
Copy link

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

No changes in tests since those are currently structured such that I cannot add display property for only one case (there is single shared template). I can restructure the tests to use separate templates (with overrideComponent) if you wish (I consider this major change since most likely majority of lines in spec file will be affected) .

PR Checklist

Before creating new PR, please take a look at checklist below to make sure that you've done everything that needs to be done before we can merge it.

  • read and followed the CONTRIBUTING.md guide.
  • built and tested the changes locally.
  • added/updated tests.
  • added/updated API documentation.
  • added/updated demos.

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
@codecov
Copy link

codecov bot commented Apr 29, 2021

Codecov Report

Merging #6071 (6a4ada2) into development (2c671b6) will increase coverage by 0.04%.
The diff coverage is 71.42%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #6071      +/-   ##
===============================================
+ Coverage        69.78%   69.83%   +0.04%     
===============================================
  Files              343      343              
  Lines             9235     9227       -8     
  Branches          2007     2006       -1     
===============================================
- Hits              6445     6444       -1     
+ Misses            2195     2189       -6     
+ Partials           595      594       -1     
Impacted Files Coverage Δ
src/collapse/collapse.directive.ts 70.66% <71.42%> (+5.60%) ⬆️
src/chronos/i18n/pl.ts 71.79% <0.00%> (-2.57%) ⬇️
src/chronos/i18n/sk.ts 80.85% <0.00%> (-2.13%) ⬇️
src/chronos/i18n/cs.ts 84.74% <0.00%> (-1.70%) ⬇️
src/chronos/i18n/uk.ts 80.48% <0.00%> (+2.43%) ⬆️
src/chronos/i18n/it.ts 100.00% <0.00%> (+28.57%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2c671b6...6a4ada2. Read the comment docs.

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

Successfully merging this pull request may close these issues.

3 participants