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(datepicker): access view child from ngAfterViewInit #3152

Conversation

jnizet
Copy link
Member

@jnizet jnizet commented Apr 27, 2019

datepicker accessed a view child from the ngAfterContentInit hook instead of accessing it from the ngAfterViewInit hook.
This doesn't work anymore with Ivy. That is a regression in Ivy, but is also an issue with ng-bootstrap which doesn't respect the standard life-cycle.
Besides, the component didn't implement the AfterContentInit interface.
It now implements the AfterViewInit interface.

fix #3150

Before submitting a pull request, please make sure you have at least performed the following:

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

datepicker accessed a view child from the ngAfterContentInit hook instead of accessing it from the ngAfterViewInit hook.
This doesn't work anymore with Ivy. That is a regression in Ivy, but is also an issue with ng-bootstrap which doesn't respect the standard life-cycle.
Besides, the component didn't implement the AfterContentInit interface.
It now implements the AfterViewInit interface.

fix ng-bootstrap#3150
@codecov-io
Copy link

Codecov Report

Merging #3152 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3152   +/-   ##
=======================================
  Coverage   92.33%   92.33%           
=======================================
  Files          91       91           
  Lines        3001     3001           
  Branches      483      483           
=======================================
  Hits         2771     2771           
  Misses        166      166           
  Partials       64       64
Flag Coverage Δ
#e2e 61.77% <100%> (ø) ⬆️
#unit 89.95% <100%> (ø) ⬆️
Impacted Files Coverage Δ
src/datepicker/datepicker.ts 98.97% <100%> (ø) ⬆️

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 6aa230e...c8fbd7f. Read the comment docs.

@marclaval
Copy link
Contributor

I've stumbled upon the same issue when making the unit tests of ng-bootstrap to pass with Ivy. This fix LGTM.

Copy link
Member

@benouat benouat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, I am literally o_O !
Thanks for spotting it. Change look good to me. We should merge.

@maxokorokov maxokorokov added this to the 4.1.2 milestone Apr 30, 2019
@maxokorokov maxokorokov merged commit 0e54eef into ng-bootstrap:master Apr 30, 2019
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.

Ivy: regression when opening a datepicker
5 participants