Skip to content

Providing Highcharts instance as described in docs causes global re-renders #440

@jamie-perkins-sp

Description

@jamie-perkins-sp

Describe the bug

In the docs we are instructed to provide highcharts like so:

provideHighcharts({
      // Optional: Define the Highcharts instance dynamically
      instance: () => import('highcharts'),
      ...

vs in the demo app, it's provided like this:

provideHighcharts({
      instance: () => import('highcharts/esm/highcharts').then(m => m.default),
      ...

Providing it like import('highcharts') causes an issue, where if you have more than one chart on a page and one re-renders, they all re-render. You can reproduce this behavior in the demo app (steps below).

Expected behavior

Regardless of which way you provide the instance, you should not see global re-renders.

Demo

Follow the steps below in the demo app in this repo.

Steps required to recreate the problem in the demo:

  1. In the demo app in this repo, run npm start
  2. In app.config.ts, comment out the current instance:
// instance: () => import('highcharts/esm/highcharts').then(m => m.default),
  1. add a new line:
instance: () => import('highcharts'),
  1. Save, and return to the browser.
  2. Click "Destroy chart" then "Recreate chart" on the first chart.
    • Both of the first 2 charts re-render.
    • The other charts are not rendering at all, I'm not sure what the issue is there.
  3. Go back to app.config.ts, change the instance back to the ESM import and save.
    • all charts render
  4. Do the same steps: Click "Destroy chart" then "Recreate chart" on the first chart.
    • Only the first chart re-renders.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions