daattali / shinycssloaders

⌛ Add loading animations to a Shiny output while it's recalculating
https://daattali.com/shiny/shinycssloaders-demo/
Other
399 stars 45 forks source link

Tabs prevent spinner from showing during recalculation #24

Closed kornl closed 4 years ago

kornl commented 6 years ago

Tabs can prevent the spinner from showing during recalculation. Here is an example:

library(shinycssloaders)

ui <- fluidPage(
  navbarPage(
    title="Menu",
    tabPanel("Tab 1",
      sliderInput(inputId = "bins", 
        label = "Number of bins:", min = 1, max = 50, value = 30)
    ),
    tabPanel("Tab 2", withSpinner(plotOutput(outputId = "distPlot"))
    )
  )
)

server <- function(input, output) {
  output$distPlot <- renderPlot({
    Sys.sleep(3)
    x    <- faithful$waiting
    bins <- seq(min(x), max(x), length.out = input$bins + 1)
    hist(x, breaks = bins, xlab = "Waiting time [min]")
  })
}

shinyApp(ui, server)

The first time Tab 2 is visited the spinner is shown. But if afterwards the slider input on Tab 1 is changed and Tab 2 visited again the spinner is not shown during recalculation.

nathanli90 commented 5 years ago

Hi @kornl,

I am wondering whether you find any method to solve this issue. Thanks a lot.

Hi @andrewsali

I have the same issue. Is there any method to solve this? Thanks a lot.

kornl commented 5 years ago

No. (For my app I added a progress bar and it was therefore obvious that there are still calculations done, even if no spinner is shown during recalculation.) Would still be interested in a fix.

ayushikachhara commented 5 years ago

Would be interested in a fix for this please

daattali commented 4 years ago

I tried your code and it works - it was fixed at some point in the past few months. If you think there's still bugs, feel free to open a new issue