plotly / plotly/plotly.R

partial_bundle() not working with Shiny

Open
#1,874 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

I've been trying to use partial_bundle() so that the plotly.js distributed is smaller and my Shiny created website loads faster
When I try to use partial bundle the plot is not showing. Using chrome dev tools it shows "ReferenceError: Plotly is not defined" in plotly.js line 162

Here is a minimal example:

library(shiny)
library(plotly)
ui <- fluidPage(
    fluidRow(plotlyOutput("distPlot"))
)
server <- function(input, output) {
    output$distPlot <- renderPlotly({
        p <- plot_ly(x = 1:10, y = 1:10)%>% partial_bundle()
    })
}
shinyApp(ui = ui, server = server)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal Shiny example in the issue and reproduce the browser's “Plotly is not defined” error from plotly.js. Trace how partial_bundle() is integrated into Shiny output; the issue is done when the plot renders in Shiny without that error while using the smaller bundle.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, r
Domain
data-visualization, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.