Skip to content
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

Fix highchart error on update before mounted. #581

Merged
merged 1 commit into from
Mar 21, 2023

Conversation

dclause
Copy link
Contributor

@dclause dclause commented Mar 21, 2023

Open the page: https://nicegui.io/reference#chart with your console opened.

You will see an error :
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'series')

This is because the chart.py component is updated without the vue component actually mounted yet, hence the chart does not exists and can be updated.
Plus, if the component unmount/remount on the life of a single page, the chart is therefore leaking. Added a destroy method to handle that.

@falkoschindler
Copy link
Contributor

Thanks for the PR, @dclause!
You're certainly right. But I can't reproduce the error. Which console do you mean, Python or JS?

@dclause
Copy link
Contributor Author

dclause commented Mar 21, 2023

Chrome console:

@falkoschindler
Copy link
Contributor

Sorry, I think I mixed up ui.chart with ui.plotly. Now that I looked at the correct example, I got the error in the JS console. And I could reproduce the issue locally with throttling the network to "Fast 3G".

Your code looks good and resolves the error. Thanks again! Let's merge it into main. 🙂

@falkoschindler falkoschindler merged commit bcd9169 into zauberzeug:main Mar 21, 2023
@falkoschindler falkoschindler added this to the v1.2.1 milestone Mar 21, 2023
@falkoschindler falkoschindler added the bug Something isn't working label Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants