Coming from here.
When buttons and other UI elements are placed in a conditionalPanel
which on app/session start should prevent displaying those elements, they are sporadically flashing for a very short time.
I tried to workaround this behaviour by including typeof input.yourChoice !== 'undefined'
into the condition, but it doesn't help.
MWE to reproduce the problem:
library(shiny)
ui <- fluidPage(
radioButtons("yourChoice", "Display button?", choices = c("Yes", "No"), selected = "No",),
conditionalPanel("input.yourChoice == 'Yes'", actionButton("test", "test"))
# not working: ------------------------------------------------------------
# conditionalPanel("typeof input.yourChoice !== 'undefined' && input.yourChoice == 'Yes'", actionButton("test", "test"))
# conditionalPanel("typeof input !== 'undefined' && input.yourChoice == 'Yes'", actionButton("test", "test"))
)
server <- function(input, output, session) {}
shinyApp(ui, server)
I'm looking for a base shiny / JS UI based solution - no renderUI
or server based workarounds.