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

perf(stark-ui): set ChangeDetectionStrategy.OnPush to UI components to prevent Angular from running unnecessary change detection cycles #1334

Conversation

christophercr
Copy link
Collaborator

@christophercr christophercr commented Jun 13, 2019

ISSUES CLOSED: #1331

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[X] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #1331

What is the new behavior?

All UI components from stark-ui use ChangeDetectionStrategy.OnPush except these ones because they are more complex or they implement the ControlValueAccessor API:

  • AppSidebar
  • DatePicker
  • DateRangePicker
  • DateTimePicker
  • Dropdown
  • GenericSearch

This PR just applies to components and NOT directives.

Does this PR introduce a breaking change?

[X] Yes (to be confirmed)
[ ] No

@coveralls
Copy link

coveralls commented Jun 13, 2019

Coverage Status

Coverage decreased (-0.03%) to 92.85% when pulling dff48b9 on christophercr:feature/ui-components-performance into d7f5fac on NationalBankBelgium:master.

@christophercr
Copy link
Collaborator Author

@SuperITMan please don't merge this PR yet because I'm still working on it, trying to enable the onPush strategy in as much components as I can 😉

I'll let you know when I finish 👍

…o prevent Angular from running unnecessary change detection cycles
@christophercr christophercr force-pushed the feature/ui-components-performance branch from e525845 to dff48b9 Compare June 28, 2019 14:34
@christophercr
Copy link
Collaborator Author

christophercr commented Jun 28, 2019

@SuperITMan @carlo-nomes @nicanac I've updated this PR. I've enabled the OnPush strategy to almost all components.

I didn't enable it in the components that implement the ControlValueAccessor API and neither in the AppSidenav and GenericSearch components. I think we should implement this in a separate PR because it might be tricky to implement and we should thoroughly test that change in those components to avoid regressions.

So this PR can already be reviewed and merged if that is ok for you guys ;)

@SuperITMan SuperITMan merged commit a3d8f5f into NationalBankBelgium:master Jul 3, 2019
@christophercr christophercr deleted the feature/ui-components-performance branch August 12, 2019 12:50
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.

performance: all - enable ChangeDetectionStrategy.OnPush wherever possible
5 participants