You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying to use your intuitive package for showing a progress on a slow computation. After finishing the computations, the user should be able to download the results. However, it seems to me that the progress bar isn't reacting to my specified max (greater than 100) number of calculations. The example below shows an example, where the bar reaches 100% before the process reaches N. I've been trying to fiddle around with various hacks involving manual setting of the increment (to 1/N) and also providing the session to the incProgressWaitress function. But nothing really works as intended. I hope you can find my bug??
A sort of solution - rather than invoking the incProgressWaiter with an adjusted amount it is only activated when the increment is bigger than a 1% of the total calculation:
library(shiny)
library(shinyjs)
library(waiter)
ui <- fluidPage(
useWaitress(),
useShinyjs(),
br(),
actionButton("load", "Load stuff"),
shinyjs::disabled(downloadButton("dwnload","Download"))
)
hep_hep_fix <- function(trick = FALSE, n, .session){
if(trick) incProgressWaitress(value = 1, session = .session)
Sys.sleep(10/n)
}
N <- 150
server <- function(input, output, session) {
output$dwnload <- downloadHandler(
filename = function() {
paste('data-', Sys.Date(), '.csv', sep='')
},
content = function(con) {
write.csv(hit_me, con)
}
)
observeEvent(input$load,{
withProgressWaitress({
for (i in 1:N) {
hep_hep_fix(trick = floor(i*100/N) > floor((i-1)*100/N), n = N, .session = session)
}
}, selector = "#dwnload", max = N, theme = "overlay-percent")
shinyjs::enable("dwnload")
hit_me <<- mtcars
})
}
shinyApp(ui, server)
Hi John
I've been trying to use your intuitive package for showing a progress on a slow computation. After finishing the computations, the user should be able to download the results. However, it seems to me that the progress bar isn't reacting to my specified
max
(greater than 100) number of calculations. The example below shows an example, where the bar reaches 100% before the process reachesN
. I've been trying to fiddle around with various hacks involving manual setting of the increment (to1/N
) and also providing the session to theincProgressWaitress
function. But nothing really works as intended. I hope you can find my bug??Best wishes,
Torben
The text was updated successfully, but these errors were encountered: