Eagerly initializing values which will be generated by renderUI


I am developing a data selection component for my shiny App.
The input is a data.frame.
Then there is a dynamic data selection UI (implemented by renderUI() ) for users to choose data by different columns.
By default, I would expect the data are completely selected thus I set the selected parameters of checkboxGroupInput() as all values.

However, since the reactive expression is lazy evaluated , the data table will be really completed only after every UI component are rendered by renderUI(). That means even though I know by default all rows are selected, I still need to click through the selectInput() choices for initializing the values which will be provided by renderUI.

I am wondering that is what is the best practice to implement such data selection component UI in shiny ?

The run example code is here:

df <- data.frame(A = sample(c("aa", "ab", "ac"), 100, T), 
                 B = sample(c("ba", "bb", "bc"), 100, T), 
                 C = sample(c("ca", "cb", "cc"), 100, T))

ui <-  fluidPage(
  titlePanel("Dynamically generated user interface components"),
                          label = "Cell Attributes",
                          choices = c("A", "B", "C")),

server <- function(input, output) {
  output$cellsCheckBox <- renderUI({
    if(is.null(input$cellsVars) ) return()

           "A"      = wellPanel(
             checkboxGroupInput("A", label = "Donors",
                                choices = c("aa", "ab", "ac"),
                                selected = c("aa", "ab", "ac") )
           "B"   = wellPanel(
             checkboxGroupInput("B", label = "Tissue",
                                choices = c("ba", "bb", "bc"),
                                selected = c("ba", "bb", "bc"))
           "C"  = wellPanel(
             checkboxGroupInput("C", label = "Annotated Cell Type",
                                choices = c("ca", "cb", "cc"),
                                selected = c("ca", "cb", "cc"))

  output$table <- renderDataTable({
    filtered <- df %>%  filter( (A %in% input$donors) & (B %in% input$tissueType) & (C %in% input$cellType))

shinyApp(ui, server)

Any comments/advice are welcome. Thank you