Closed RoelVerbelen closed 3 years ago
Thanks for the details and the code sample. I can confirm this is indeed an issue.
Since similar issues happen in shiny (not graying out), it leads me to believe that the problem lies with shiny's javascript where it doesn't correctly inform the output element when it's recalculating. I haven't actually spent time on troubleshooting, but that's my educated guess. I don't think I'd invest time looking into this until it's fixed in shiny - and when it is fixed in shiny, it might automatically fix the issue here as well.
Thank you, Dean. I just thought it was worth posting here as well, since there are similar instances where Shiny fails to gray out plots, but wrapping it in withSpinner()
solves the it.
Here's the minimal example I used in the Shiny github issue.
library(shiny)
ui <- navbarPage(
title = "Minimal Example",
tabPanel("Controls", sliderInput("slider", "Number of observations:", 1, 150, 50, 1)),
tabPanel("Plot", plotOutput("plot", height = 250))
)
server <- function(input, output) {
# Slowly compute histogram
output$plot <- renderPlot({
Sys.sleep(2)
data <- iris$Sepal.Length[seq_len(input$slider)]
hist(data)
})
}
shinyApp(ui, server)
Shiny fails to gray out the plot in the other tab, whereas with withSpinner()
it works as expected.
ui <- navbarPage(
title = "Minimal Example",
tabPanel("Controls", sliderInput("slider", "Number of observations:", 1, 150, 50, 1)),
tabPanel("Plot", shinycssloaders::withSpinner(plotOutput("plot", height = 250)))
)
shinyApp(ui, server)
That's a good but unintended behaviour that withSpinner works in cases where shiny's default recalculation doesn't work :)
It's good to know about this issue, but I maintain that if it's an issue with base shiny then I don't feel pressured to try to fix it in an extension. I would welcome a PR if anyone finds the cause and an elegant way to fix, but otherwise I'd leave the issue open and follow up when it's addressed in shiny.
I'm closing this issue since it's an issue with shiny as well, and I assume it would get fixed when shiny fixes it
First of all, thank you for all your open source Shiny contributions! I've been enjoying your packages and have learned a lot from your online videos/tutorials/posts.
I've been using
withSpinner()
to indicate when calculations/graphs are being updated, but noticed it only works the first time and doesn't reload within amodalDialog()
Minimum reproducible example (tested on dev version of shinycssloaders):
I've included this examples also in a related issue in the shiny github repo, since the plot also doesn't gray out without
withSpinner()
as it is supposed to. I am hopingwithSpinner()
can be adapted to include this scenario.