posit-dev / posit-dev/shinylive
Plotly fails to initialize upon app start
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 251
- Forks
- 25
- Avg merge
- 19m
- Merged PRs (30d)
- 2
Description
I have written a Shiny App that will render two plotlyOutputs when it is started. I'm hosting this app as a shinylive app on a Microsoft Internet Information Services webserver. When visiting the website, only the second plot is actually rendered correctly, the first plot fails with the following error message in the browser console:
Uncaught (in promise) ReferenceError: Plotly is not defined
at Object.renderValue (plotly.js:162:18)
at htmlwidgets.js:539:22
As soon as I modify the first plot, i.e. using some control widgets to filter the underlying data causing the plot to re-render, everything works fine.
Furthermore, everything works fine when I run the shiny app locally using RStudio, which leads me to believe that the issue might be caused by shinylive.
Edit: Here is a simple demo app showing the problem: https://valentin-kamm.github.io/shinylivePlotlyIssueDemo/
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked shinylive demo and reproduce the initial-load failure in the browser. Read the browser console trace through plotly.js and htmlwidgets.js, then compare the initial render with the successful re-render after changing the first plot. Done means both plots render on startup without the “Plotly is not defined” error in the hosted app.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, r
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100