Shiny reactiveUI hangs with multiple uiOutput calls with the same condition variable

I am trying to create a reactive user interface with sliders that exit and exit the dropdown list. I have a server with reactiveUI sliders (server.R):

library(shiny)
shinyServer(function(input, output) {
  output$slider1 <- reactiveUI(function() {
    sliderInput("s1", "slide 1", min = 1,  max = 100, value = 1)  
  })

  output$slider2 <- reactiveUI(function() {
    sliderInput("s2", "slide 2", min = 1,  max = 100, value = 1)   
  }) 
})

I can start the server using the following code (ui.R):

library(shiny)
shinyUI(pageWithSidebar(
  headerPanel("Hello Shiny!"),
  sidebarPanel(

    selectInput("dataset", "number of buckets:", 
                choices = c(1,2,3)),

    conditionalPanel(
      condition = "input.dataset==2",
      uiOutput("slider1"),uiOutput("slider2")),

    conditionalPanel(
      condition = "input.dataset==1",
      sliderInput("s1", "slide 1", min = 1,  max = 100, value = 1) 
      )
  ),
  mainPanel(
  )
))

but if I try to force conditional pairs to call uiOutput, the server freezes:

library(shiny)
shinyUI(pageWithSidebar(
  headerPanel("Hello Shiny!"),
  sidebarPanel(

    selectInput("dataset", "number of buckets:", 
                choices = c(1,2,3)),

    conditionalPanel(
      condition = "input.dataset==2",
      uiOutput("slider1"),uiOutput("slider2")),

    conditionalPanel(
      condition = "input.dataset==1",
      uiOutput("slider1") 
      )
  ),
  mainPanel(
  )
))

I communicated with this and found that this happens anytime when the same condition variable and multiple uiOutput calls are used. Any suggestions? Thank.

+5
source share
1 answer

See a comment from @Joe for an answer.

, outputID inputIDs ; . .

@Jim , , .

 output$slider2_1 <- ...
 output$slider2_2 <- ...
+4

All Articles