Chart initialized in unmounted component #3725
Labels
React 18/19
Issue or pull request is *only* related to React 18/19
Type: Bug
Issue contains a defect related to a specific component.
Milestone
Describe the bug
The
initChart
method will in some case asynchronously create a chart object (after loadingchart.js/auto
). If during the asynchronous process the Chart component was already unmounted, the Chart will still be created, but for anull
canvas. As a consequence, a zombie Chart is created that is never cleaned up.Context/Usage
We have a simple usage of a line chart, which is rendered for each detail of a master-detail view. That means switching the selection between the entries in the master view will each time unmount the Chart component and then create a new one with different curve data.
The mentioned issue can be provoked already with a minimal Chart as this (but also with actual configuration and data):
Issue
Oftentimes we see these two errors in the log while switching from one detail to the other:
Reproducer
No response
PrimeReact version
8.7.2
React version
18.x
Language
TypeScript
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
No response
The text was updated successfully, but these errors were encountered: