rstudio / shiny

Easy interactive web applications with R
http://shiny.rstudio.com
Other
5.3k stars 1.87k forks source link

Hide the busy pulse when disconnected #4061

Closed cpsievert closed 1 month ago

cpsievert commented 1 month ago

Currently, when useBusyIndicators() is activated, and the app disconnects while shiny is busy (e.g., an error in an observer occurs), you may get a pulse at the top of the page. That isn't an ideal experience because the server isn't actually busy -- it's been disconnected.

Here's a testing app for the change. Before this change, the pulse would persist after the error occurs. After this change, the pulse goes away after the error occurs.

https://github.com/rstudio/shiny/assets/1365941/337b474e-4743-4bc1-bf9a-a6ecaff2bda8

library(shiny)

ui <- fluidPage(
  useBusyIndicators(),
  actionButton("btn", "Generate error"),
  plotOutput("p"),
)

server <- function(input, output, session) {

  observeEvent(input$btn, {
    Sys.sleep(2)
    stop("boom")
  })

  output$p <- renderPlot({
    Sys.sleep(2)
    plot(1)
  })

}

shinyApp(ui, server)