Skip to content

[Bug] Graph force layout runs after dispose #19507

@miserman

Description

@miserman

Version

5.4.3

Link to Minimal Reproduction

https://jsfiddle.net/6rx1hmou/43/

Steps to Reproduce

In the example, the text shows whether the graph is laying out. Uncomment chart.dispose() to see that it continues to layout with no chart.

To reproduce from scratch:

  1. Make a chart with graph type series and force layout, with enough data to take a little while to layout.
  2. Dispose chart.
  3. Look at CPU usage or log processes.

Current Behavior

Force layout steps continue to fire after chart has been disposed.

Expected Behavior

It would be nice if steps were stopped if the chart no longer exists, and maybe if there was a function to force steps to stop.
For now, before disposing, I'm manually clearing the timeout and setting _layouting to false.

Environment

- OS: Window 11
- Browser: Chrome 122.0.6238.2
- Framework: React@18.2.0

Any additional comments?

This came up in the context of a graph made dynamically from user input that could get quite large. After making a large graph, everything would slow down even after switching to a smaller one, because the first one was still being processed in the background.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions