-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Page crashes after some time #180
Comments
I have the same issue on a page that refreshes the displayed data every 10 seconds. I just had a quick look at the base chart class and it appears to use an ID from the Config for the chart component. Since the Config is being recreated, a new ID is being generated. This means that Blazor cannot locate the original chart component to check for changes in the DOM. Workaround: Do not recreate the Config instance within the InitChartData() method. Create an instance in the Page Initialize() method, and then update the properties, such as Options. You will need to keep the original Config instance so the ID doesn't change. Possible Fix: Allow the ID to be specified in the Config constructor, or make the ID property read/write. Note that this means that all sample code where this technique is being used will need to be changed as well. Edit: Alternatively, just move the CanvasId into the Chart component. I have submitted a PR with this. |
Describe the bug
We have implemented ChartJs within a blazor page. When we go to the page everything works fine. Now if we leave the tab open for x minutes/hours, the website crashes and we get an error message.
I don't got this behaviour in Firefox yet, only in Chrome.
Which Blazor project type is your bug related to?
Which charts does this bug apply to?
<Chart Config="_chartConfig" @ref="_chart" />
To Reproduce
Steps to reproduce the behavior:
We are using ChartJs v 2.0.2.
We implemented the chart in this way:
<Chart Config="_chartConfig" @ref="_chart" />
InitChartData()
is called inOnParametersSetAsync()
Now keep the page open. It can take up to a few few minutes or hours until the page crashes.
Additional context / logging
Add any additional context about the problem here.
Code example
Please provide full code examples below where possible to make it easier for the developers to check your issues.
Please also add the working JavaScript equivalent so we can see what you were trying to achieve.
The text was updated successfully, but these errors were encountered: