Skip to content

Conversation

@Thoronion
Copy link
Contributor

This is a fix for issue #470. If using more than one chart on a page in a fast loading environment, such as a production environment, charts might fail to render on subsequent visits to the page.

Possible timeline:

First page visit:

Chart-1: Plotly might not be loaded -> calls end up in plotlyReadyCallback queue.
script.onload is fired, executing Chart1 callbacks and renders Chart-1.
Chart-2 is rendered directly since Plotly is loaded, which means no callbacks in queue.

Second page visit:

Chart-3: Since plotly is already loaded renders directly with no callbacks in queue.
script.onload is fired trying to execute callbacks for Chart-1 which does not exist and causes an uncaught exception.
Chart-4 is not rendered due to uncaught errors.

Note that the exceptions can still be thrown even with one plot on the page but mostly the chart is already rendered when the exception is thrown.

@sean-mcl sean-mcl merged commit 156077c into LayTec-AG:main May 5, 2025
@sean-mcl
Copy link
Collaborator

sean-mcl commented May 5, 2025

Thanks for the PR 🙏🏻.
Will create a new release tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants