eclipsesource / jsonforms

Customizable JSON Schema-based forms with React, Angular and Vue support out of the box.
http://jsonforms.io
Other
2.12k stars 359 forks source link

abstract-control (angular) state subscription is not cleared #2354

Open Ketec opened 2 months ago

Ketec commented 2 months ago

Describe the bug

https://github.com/eclipsesource/jsonforms/blob/master/packages/angular/src/library/abstract-control.ts ngOnDestroy does unsubscribe, but this.jsonFormsService.$state.subscribe is never actually assigned to the variable.

So every schema change adds new subscriptions and old ones still remain active and trigger.

Expected behavior

removed controls are unsubscribed

Steps to reproduce the issue

### Screenshots _No response_ ### Which Version of JSON Forms are you using? 3.3.0 ### Framework Angular ### RendererSet Other (please specify in the Additional context field) ### Additional context _No response_
lucas-koehler commented 2 months ago

Hi @Ketec , thanks for the report. That indeed seems like a bug. Would you like to contribute a fix?

Ketec commented 2 months ago

I'm not set up to run it locally for tests ( or even how it is set up here). An open question also would be about the potential use cases with custom renderers that may extend this and use this.subscription for other observables.

It likely needs a separate property to ensure it's backwards compatible.