Skip to content

promises support for new shiny async #1209

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

Closed
fabiangehring opened this issue Mar 5, 2018 · 0 comments
Closed

promises support for new shiny async #1209

fabiangehring opened this issue Mar 5, 2018 · 0 comments

Comments

@fabiangehring
Copy link

fabiangehring commented Mar 5, 2018

Shiny supports async evaluation in it's current dev (async branch merged a few days ago). Plotly does not seem to support this new functionaility yet.

The error of the following minimal app says: "no applicable method for 'ggplotly' applied to an object of class "promise""

library(shiny)
library(plotly)
library(promises)
library(future)
plan(multiprocess)

ui <- fluidPage(
  sidebarLayout(
    sidebarPanel(
      sliderInput("n",
                  "Test:",
                  min = 1,
                  max = 50,
                  value = 30)
    ),
    
    mainPanel(
      plotlyOutput("plot")
    )
  )
)

server <- function(input, output) {
  getData <- function(n) {
    data.frame(x = sample(n), y = sample(n))
  }
  
  data <- reactive({
    n <- input$n
    future(getData(n))
  })
 
  output$plot <- renderPlotly({
    data() %...>%
      plot_ly(x = ~x, y = ~y)
  })
}

shinyApp(ui = ui, server = server)
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

No branches or pull requests

1 participant