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): no animations in production mode #4044

Conversation

maxokorokov
Copy link
Member

This is caused by the Terser pure_getters optimization.
If used only once (ex. when importing ONLY NgbCollapseModule), the reflow function is broken:

// source
export function reflow(element: HTMLElement) {
  return (element || document.body).offsetHeight;
}

reflow(el);

// inlined in production
function(element) {
    element || document
}(element)

Fixes #3972

This is caused by the Terser `pure_getters` optimization.
If used only once (ex. when importing ONLY `NgbCollapseModule`), the `reflow` function is broken:

```ts
// source
export function reflow(element: HTMLElement) {
  return (element || document.body).offsetHeight;
}

reflow(el);

// inlined in production
function(element) {
    element || document
}(element)
```

Fixes ng-bootstrap#3972
@codecov-io
Copy link

Codecov Report

Merging #4044 (b461c13) into master (71ca123) will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4044   +/-   ##
=======================================
  Coverage   88.14%   88.14%           
=======================================
  Files         112      112           
  Lines        3611     3611           
  Branches      674      674           
=======================================
  Hits         3183     3183           
  Misses        358      358           
  Partials       70       70           
Flag Coverage Δ
e2e 46.37% <0.00%> (ø)
unit 87.44% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/util/util.ts 57.89% <0.00%> (ø)

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 71ca123...b461c13. Read the comment docs.

@maxokorokov maxokorokov merged commit 5e25272 into ng-bootstrap:master Mar 22, 2021
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.

No animation on ngbCollapse in Angular 11.1 in production build
2 participants