Skip to content

[options] in <highcharts-angular> is not immutable #174

Open
@dolanmiu

Description

@dolanmiu

When passing options into <highcharts-angular> via the async pipe, it mutates the options object.

<highcharts-chart
  *ngIf="chartOptions$ | async as chartOptions"
  class="chart"
  [Highcharts]="Highcharts"
  [options]="chartOptions"
  [runOutsideAngular]="true"
></highcharts-chart>

chartOptions$ is an observable which takes chartOptions from ngrx store, but whenever I change data in the store, it mutates the PREVIOUS value stored in the store.

I fixed this by deep cloning the chartOptions before it gets passed into highcharts-cangular:

JSON.parse(JSON.stringify());

But can we have an official fix?

Here is the StackBlitz to re-produce the problem:

https://stackblitz.com/edit/angular-soounx

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions