ng-dynamic-forms icon indicating copy to clipboard operation
ng-dynamic-forms copied to clipboard

Memory Leaks

Open tylerthrash opened this issue 5 years ago • 1 comments

In DynamicFormControlModel there's a memory leak from this line of code:

this.disabled$.subscribe(disabled => this._disabled = disabled);

as well as in DynamicFormValueControlModel from this line of code:

this.value$.subscribe(value => this._value = value);

This has been causing issues of retaining values after leaving the page and then coming back. However, even if I create a new model instance, there's a memory leak from the old instance(s). The subscription should be moved in a component so it can be unsubscribed from in NgOnDestroy.

tylerthrash avatar Dec 05 '19 17:12 tylerthrash

Also, I think "value" should be publicly accessible on DynamicFormValueControlModel.

So, changing @serializable("value") private _value: T | null; to @serializable("value") _value: T | null;

tylerthrash avatar Dec 06 '19 18:12 tylerthrash