Below is an example Shiny app:
ui.R:
shinyUI(fluidPage(
# Application title
titlePanel("Test select input event"),
sidebarLayout(
sidebarPanel(
selectInput('testSelect', 'Test',choices = c(1,2,3), multiple = FALSE)
),
mainPanel(
)
)
))
server.R:
shinyServer(function(input, output) {
observeEvent(input$testSelect,{ print("I am getting trigerred unnecessarily")})
})
When I start this app the console logs immediately show:
Listening on http://127.0.0.1:5017
[1] "I am getting trigerred unnecessarily"
It seems that observeEvent on a select input is triggered unnecessarily at the start of the app. Can someone please explain this behaviour?