daattali / shinycssloaders

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

Changed behaviour using shinycssloaders 0.3 #40

Closed ismirsehregal closed 4 years ago

ismirsehregal commented 4 years ago

The following code snippet was rendering the spinner just fine using shinycssloaders 0.2.0. After updating to 0.3 the spinner is no longer rendered.

Is this change intentional?

library(shiny)
library(shinycssloaders)

ui <- fluidPage(
  withSpinner(p(), type = 6)
)

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

shinyApp(ui, server)
daattali commented 4 years ago

Can you elaborate on the usecase for this?

It's possible that it worked previously but I don't think it was explicitly meant to work. It's meant to work with shiny outputs only, anything else that might work is not a guarantee in my opinion.

ismirsehregal commented 4 years ago

I used it to stay in (manual) control of showing/hiding the spinner in context of uiOutputs using conditionalPanels. Otherwise, depending on what is rendered (using renderUI) the Spinner is showing up much too late.

I think the problem is described here (div without id).

ismirsehregal commented 4 years ago

The following works equivalent:

library(shiny)
library(shinycssloaders)

ui <- fluidPage(
  checkboxInput("toggle", "toggle"),
  conditionalPanel(condition = "input.toggle", withSpinner(uiOutput("spinnerDummyID1"), type = 6))
)

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

shinyApp(ui, server)

Closing the issue accordingly.