ng-dynamic-forms
ng-dynamic-forms copied to clipboard
Memory Leaks
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.
Also, I think "value" should be publicly accessible on DynamicFormValueControlModel.
So, changing
@serializable("value") private _value: T | null;
to
@serializable("value") _value: T | null;