I have a complex Shiny app. I have a selectize output object, selectTest, the value of which is read by a reactive object, isTestReady. isTestReady evaluates whether certain conditions are satisfed by selectTest. isTestReady is then used in various chunks as a gate. I have set selectTest as outputOptions(suspendWhenHidden = F, priority  999) to ensure it gets up and running immediately.
On running, I notice the chunk for selectTest gets executed first. When isTestReady runs after this, it still reads the value of selectTest as NULL instead of whatever value that was assigned to selectTest in the first chunk. Shiny then goes through many of the other modules before returning to re-evaluate isTestReady. After the re-evaluation, the other chunks are called again and now they run fine.
Is that expected behaviour? If so, any ideas on how to make my scenario play the way I described it?
Example -
library(shiny)
library(shinydashboard)
# Setup Shiny app UI components -------------------------------------------
ui <- dashboardPage(
   dashboardHeader(),
   ## Sidebar content
   dashboardSidebar(
      sidebarMenu(
         uiOutput('someelement'),
         textOutput('temp2')
      )
   ),
   dashboardBody(  )
)
# Setup Shiny app back-end components -------------------------------------
server <- function(input, output) {
   output[['someelement']] = renderUI({
      selectizeInput(
         inputId = 'someelement',
         choices = letters,
         selected = letters[1],
         label = 'Custom Functions',
         multiple = F
      )
   })
   outputOptions(
      output,
      'someelement',
      suspendWhenHidden = F
   )
   temp = reactive({
      print('?')
      input[['someelement']]
   })
   observe({
      print('!')
      print(temp())
   })
   output[['temp2']] = renderText({
      print('!!')
      print(temp())
      '-'
   })
}
# Render Shiny app --------------------------------------------------------
shinyApp(ui, server)
The logs output to the console for the above app look as follows -
[1] "!"
[1] "?"
NULL
[1] "!!"
NULL
[1] "!"
[1] "?"
[1] "a"
[1] "!!"
[1] "a"
Any way to avoid that NULL? In my app, there are a lot of chunks that look for temp(), all of which run before temp().
 
     
     
    