-
Couldn't load subscription status.
- Fork 219
Description
Description
When a Gauges component is rendered in an Angular component, loaded via Angular routing, combined with a parent component that listens to the router's events and immediately updates its state (e.g., through a property update that triggers change detection), the following error occurs:
Steps To Reproduce
- Open the following StackBlitz example - https://stackblitz.com/edit/angular-xpg1cree-oi4cgn9y
- Observe the error that emerges in the console.
Actual Behavior
It appears that the triggered change detection cycle upon initialization causes Angular to destroy and recreate the component, which calls the Gauge's ngOnDestroy method before its initialization is entirely complete. In turn, the ngOnDestroy method tries to clean up subscriptions before they are fully set up and the error emerges.
Expected Behavior
No error should be thrown in this scenario since we should internally check if the subscriptions are actually available before unsubscribing to them.