juba / shinyglide

Glide.js component for Shiny apps
https://juba.github.io/shinyglide/
91 stars 8 forks source link

reload of glide() inside renderUI causes glide functionalities to disappear #26

Closed ChristianKahmann closed 3 years ago

ChristianKahmann commented 3 years ago

Hi, I am trying to display a glide() window dynamically within a RenderUI statement to be able to customise it as required by different user specifications.

However, as soon as the UI output element is recalculated here, the entire glide functionality disappears. This includes the possibility to jump to other windows.

I am attaching a small minimal example in which this can be seen.

library(shiny)
library(shinyglide)

ui <- fixedPage(
  titlePanel("test shinyglide"),
  mainPanel(
    actionButton(inputId = "reload",label = "reload"),
    tags$br(),
    uiOutput(outputId = "glide_test_UI")
  )
)

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

  output$glide_test_UI<-renderUI({
    input$reload
    glide(id = "test_glide",
      screen(
        tags$h4(runif(1,0,10)),
        p("Screen1")
      ),
      screen(
        p("Screen2")
      ),
      screen(
        p("Screen3")
      )
    )
  })
}

shinyApp(ui, server)

When loading the app for the first time, everything works and the interface looks like this: first run

After pressing reload, the Next button can no longer be pressed. The interface then looks like this: after reload

I appreciate any assistance you can give me.

juba commented 3 years ago

Hi,

Thanks for the detailed report and the reproducible example ! I just pushed a commit to the development version which, I think, may fix the issue. Could you please test it and see if it is okay for you too ?

Thanks !

ChristianKahmann commented 3 years ago

yes now it works perfectly.

Thank you very much!