Thank's for the quick reply Joe.
I didn't quite follow your suggestion. I put together a simple app to illustrate what I'm seeing:
ui.R
shinyUI(bootstrapPage(
textInput(inputId='nords', label='Random Obs: ', value=10),
uiOutput("selectInputData")
))
server.R
shinyServer(function(input, output) {
genListData <- reactive(function()
{
print(paste('Generating List Data - input$nords = ', input$nords))
c(0, rnorm(input$nords))
})
output$selectInputData <- reactiveUI(function()
{
print('Output SelectInputData Called...')
dList = as.list(genListData())
selectInput(inputId='randomList', label='Random Select List', choices=dList, selected=0)
})
output$nullOutput <- reactive(function() {
print(paste('output$nullOutput func depends on input$randomList - value =', input$randomList))
})
})
The output generated (no UI interaction) is:
R> shiny::runApp('shinyApp/')
Listening on port 8100
[1] "Output SelectInputData Called..."
[1] "Generating List Data - input$nords = 10"
[1] "output$nullOutput func depends on input$randomList - value = "
[1] "output$nullOutput func depends on input$randomList - value = 0"
So my original issue/question had to do with why output$nullOutput is triggered twice - once when input$randomList is null and then second time it contains the default value that I gave in the reactiveUI function. There is no way in the server.R to set input$randomList = 0 initially (it's valid syntax but the change isn't reflected)
I think reactiveUI, nullOutput, etc in the server.R are evaluated all at the same time - so during the first evaluation round, I don't think it matters if you change the input$randomList value in reactiveUI.
I wonder if there should be a way to initialize reactiveUI components before the server.R evaluates/generates its content - maybe in ui.R
Hopefully the example makes sense
Cheers
-Haider