You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noted that under RC1 my app becomes laggy as I switch between components, with further investigation I've identified the translate pipe as the culprit.
It seems that the EventEmitter that it uses to detect language changes is never disposed of (despite the ngOnDestroy implementation) and therefore as you move around your app the number of event listeners increases.
I've produced a simple plunker with a pipe implementation based on the ng2-translate one to demonstrate, instructions to reproduce are in the info pane. http://plnkr.co/edit/TTgOOkhUvpz1d6C0qMgl?p=info
Reverting to Beta 17 does not show the same behaviour.
I have also produced a fixed version that uses a Subject rather than EventEmitter, and this one is disposed of correctly. This was following advice on the Angular2 Gitter (from @escardin specifically) about EventEmitter vs Subject, and that EventEmitter should only ideally be used with @output.
I've noted that under RC1 my app becomes laggy as I switch between components, with further investigation I've identified the translate pipe as the culprit.
It seems that the EventEmitter that it uses to detect language changes is never disposed of (despite the ngOnDestroy implementation) and therefore as you move around your app the number of event listeners increases.
I've produced a simple plunker with a pipe implementation based on the ng2-translate one to demonstrate, instructions to reproduce are in the info pane.
http://plnkr.co/edit/TTgOOkhUvpz1d6C0qMgl?p=info
Reverting to Beta 17 does not show the same behaviour.
I have also produced a fixed version that uses a Subject rather than EventEmitter, and this one is disposed of correctly. This was following advice on the Angular2 Gitter (from @escardin specifically) about EventEmitter vs Subject, and that EventEmitter should only ideally be used with @output.
The implementation that uses Subject can be found here:
http://plnkr.co/edit/cTuZvvStG2QNrtEgu3pk?p=info
The text was updated successfully, but these errors were encountered: