We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
TranslocoService
1 parent 9ec9e71 commit 3650240Copy full SHA for 3650240
projects/ngneat/transloco/src/lib/transloco.service.ts
@@ -515,6 +515,11 @@ export class TranslocoService implements OnDestroy {
515
516
ngOnDestroy() {
517
this.subscription.unsubscribe();
518
+ // Caretaker note: since this is the root provider, it'll be destroyed when the `NgModuleRef.destroy()` is run.
519
+ // Cached values capture `this`, thus leading to a circular reference and preventing the `TranslocoService` from
520
+ // being GC'd. This would lead to a memory leak when server-side rendering is used since the service is created
521
+ // and destroyed per each HTTP request, but any service is not getting GC'd.
522
+ this.cache.clear();
523
}
524
525
private isLoadedTranslation(lang: string) {
0 commit comments