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(animations): don't reflow in 'ngbRunTransition' #3962

Conversation

maxokorokov
Copy link
Member

Replace a generic reflow() call in ngbRunTransition:

  • introduce granular per-component reflows only when necessary
  • take into account animation flag for reflows

Fixes #3954
Fixes #3952

@@ -397,7 +395,7 @@ export class NgbAccordion implements AfterContentChecked {
this.activeIds = this.panels.filter(panel => panel.isOpen && !panel.disabled).map(panel => panel.id);
}

private _runTransitions(animation: boolean, emitEvent = true) {
private _runTransitions(animation: boolean) {
Copy link
Member Author

Choose a reason for hiding this comment

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

note: removing this, because it is never used

@maxokorokov maxokorokov force-pushed the animations/fix/unnecessary-reflows branch from f1b1637 to b0a9cca Compare January 20, 2021 13:56
src/collapse/collapse.ts Outdated Show resolved Hide resolved
Replace a generic `reflow()` call in `ngbRunTransition`:
- introduce granular per-component reflows only when necessary
- take into account `animation` flag for reflows

Fixes ng-bootstrap#3954
Fixes ng-bootstrap#3952
Copy link
Member

@fbasso fbasso left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @maxokorokov, LGTM !

Besides fixing the issues, I feel the code much better this way, with a more fine grain control on what to do for each animation, with or without animation enabled.

@maxokorokov maxokorokov merged commit ad3c9c3 into ng-bootstrap:master Jan 20, 2021
maxokorokov added a commit that referenced this pull request Jan 21, 2021
Replace a generic `reflow()` call in `ngbRunTransition`:
- introduce granular per-component reflows only when necessary
- take into account `animation` flag for reflows

Fixes #3954
Fixes #3952

(cherry picked from commit ad3c9c3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants