I am trying to save user-selected values in a dynamically generated selectInput after the user changes the selection in another option selectInput(multiple=T). Whenever I change my selection, all dynamically generated values are reset.
For instance:
First I select "A", "B" and "C" from the "Letters" selectInput, and then select "1"; "12" ; and "1", "2", "3" from the dynamically generated input selection options generated by "A", "B" and "C".
Initial parameters:

"Letters" selectInput, "A" "B" (.. "C" ). , "A", , "B" (.. "1" "a" "1" "2" "b" ), reset.
Reset () a b:

a b c ( )?
library(shiny)
ui <- fluidPage(
sidebarPanel(
uiOutput("n1"),
uiOutput("n2")
),
mainPanel(
textOutput("Current"),
textOutput("Old")
)
)
server <- function(input, output, session){
output$n1 <- renderUI({
selectInput("no1", "Letters", choices=c("A", "B", "C"), multiple=T)
})
output$n2 <- renderUI({
if(!is.null(input$no1)){
lst <- vector("list", length(input$no1))
for(i in 1:length(lst)){
lst[[i]] <- selectInput(input$no1[i], input$no1[i], choices=c(1,2,3), multiple=T)
}
return(lst)
}
})
Values <- reactiveValues(old="start")
session$onFlush(once=FALSE, function(){
isolate({ Values$old<-input$A })
})
output$Current <- renderText({paste(input$A)})
output$Old <- renderText({paste(Values$old)})
}
shinyApp(ui,server)