waiter icon indicating copy to clipboard operation
waiter copied to clipboard

Visual error with infinite line waitress when restarting the loading bar

Open Dschaykib opened this issue 4 years ago • 1 comments

Hi, when using the waitress with line and infinite settings, there is a bug with the loading bar if a second $start() is initialized before a $close() is stated.

Sample Code for a simple App with a start and stop button and a visual of the error:

library(shiny)
library(waiter)

ui <- fluidPage(
  use_waitress(),
  p("App content"),
  uiOutput("start_button"),
  uiOutput("stop_button"),
  uiOutput("exit_button"),
  textOutput(outputId = "desc")
)

server <- function(input, output){

  output$exit_button <- renderUI({
    actionButton("exit", label = "Exit", width= "20%")
  })
  output$stop_button <- renderUI({
    actionButton("stop", label = "Stop", width= "20%")
  })
  output$start_button <- renderUI({
    actionButton("start", label = "Start", width= "20%")
  })
  output$desc <- renderText({
    paste0("Initial time ", Sys.time())
  })
  
  # call the waitress
  waitress <- Waitress$new(theme = "line", infinite = TRUE)
  
  observeEvent(input$stop, {
    waitress$close()
    output$desc <- renderText({paste0("stop at ", Sys.time())})
  })
  
  observeEvent(input$exit, {
    shiny::stopApp()
  })
    
  observeEvent(input$start, {
    waitress$start()
    output$desc <- renderText({paste0("start at ", Sys.time())})
  })
}

shinyApp(ui, server)

https://user-images.githubusercontent.com/26231434/107010972-52189f00-6797-11eb-8ed5-a395f2571b1b.mov

Dschaykib avatar Feb 05 '21 08:02 Dschaykib

Sorry I have not fixed this yet, it's really busy with work on my end at the moment.

JohnCoene avatar Feb 12 '21 19:02 JohnCoene