Skip to content

Gauges in a routing scenario causing an error #4707

@zstoyanova9

Description

@zstoyanova9

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:

Image

Steps To Reproduce

  1. Open the following StackBlitz example - https://stackblitz.com/edit/angular-xpg1cree-oi4cgn9y
  2. 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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions