rstudio / promises

A promise library for R
https://rstudio.github.io/promises
Other
198 stars 19 forks source link

future wrapper does not work with download button #44

Open nvshah286 opened 5 years ago

nvshah286 commented 5 years ago

I am trying to do async for a download button my shiny app. The file download takes 8-10 seconds so i want to run it in background and make the app available for the users in that time.

I wrapped the download function with future . But it does not work as expected.

script :

output$Report <- shiny::downloadHandler(

  filename = function(){
    fileName
  },
  content = function(file) {
     params = list(origin =input$Origin,
                   destination = input$Destination)
     # knit the document 
     observe(print(params))
     observe(head(flightsData))

     future({
       downloadPpt(fileName = fileName, inputParams = params)
       file.copy(file.path(filePath,fileName),file)
     })

  }   

)
king-of-poppk commented 1 year ago

This issue belongs to Shiny, not promises.