-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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(progress-circle): clean up animation on destroy #617
Conversation
@crisbeto Can you add a unit test for this? |
992822e
to
c008804
Compare
Done @jelbourn, although some of the CI builds are failing because of unrelated issues. (missing |
.then((fixture) => { | ||
fixture.detectChanges(); | ||
let progressElement = getChildDebugElement(fixture.debugElement, 'md-progress-circle'); | ||
expect(progressElement.componentInstance._interdeterminateInterval).toBeTruthy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't access the private member here; The field either needs to be changed to /** @internal */
or we need some other proxy for checking that the interval has stopped.
Only remaining CI errors are lint |
c7a6abf
to
bedbfda
Compare
It's updated to use a getter/setter on the interval and resetting it on the setter instead to avoid intervals stacking up. The CI is still throwing a Node ELIFECYCLE error, though. |
That node error message is just garbage that gets thrown when there's a tslint error. The actual problem is just above: |
/** The id of the last requested animation. */ | ||
private _lastAnimationId: number = 0; | ||
|
||
/** The id of the indeterminate interval. */ | ||
private _interdeterminateInterval: number; | ||
get interdeterminateInterval() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be marked as /** @internal */
bedbfda
to
146b497
Compare
There we go. @jelbourn. EDIT: Regarding wrapping the tests in |
/** The id of the indeterminate interval. */ | ||
/** | ||
* The id of the indeterminate interval. | ||
* @internal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @internal
actually goes on the public member rather than the private one; this tells TypeScript to omit the property when outputting a .d.ts
file so that downstream users can't depend on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm still not too familiar with all the ng2 concepts. It's updated now.
The indeterminate animation is based on an interval that keeps running, even after the element has been destroyed. This change cleans up when the element is destroyed. Also adds an extra null check for `performance.now`.
146b497
to
2ebbeb3
Compare
LGTM |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The indeterminate animation is based on an interval that keeps running, even after the element has been destroyed.
This change cleans up when the element is destroyed.
Also adds an extra null check for
performance.now
.