title: problem in adding several shiny modules using insertUI
body: <p>I build a shiny app that need to add pieces of UI dynamically based on some parameter I'll know only in real time. I created a simplistic reconstruction of my needs, and encountered a problem I describe below</p>
  <p>so in my example I have a module called mblock. for the sake of this example it only displays a text. the actual text to display is decided at run time, and so is the number of texts (and hence blocks) will be decided at runtime</p>
  <p>for the specific example I set texts to be a fixed vector containing all the texts to be shown, but in reality it will be computed as a reactive object. the code is below:</p>
  <pre><code>library(shiny)
  
  #block module
  mblockUI = function(id) {
      ns = NS(id)
      fluidRow(
          textOutput(ns(&quot;text&quot;))
      )
  }
  
  mblock = function(input,output,session,actual_text) {
      output$text = renderText({actual_text})
  }
  
  
  # Define the main ui 
  ui &lt;- fluidPage(
      uiOutput(&quot;all_blocks&quot;),
      actionButton(&quot;submit&quot;,&quot;submit&quot;)
  )
  
  # Define server logic
  server &lt;- function(input, output) {
      texts = c(&quot;aaaa&quot;,&quot;bbbb&quot;,&quot;cccc&quot;) #this is a sample vector of texts to be shown in blocks
  
      output$all_blocks = renderUI({
          for(i in 1:length(texts)) {
              mname = paste0(&quot;block&quot;,i)  #block name to be created (the name of the module)
              #print(mname)
              insertUI(&quot;#submit&quot;,&quot;beforeBegin&quot;,mblockUI(mname))  #adding the ui
              #now adding the server side of each block
              #also passing the text to be shown
              callModule(mblock,mname,texts[i])     
          }
      })
  }
  
  # Run the application 
  shinyApp(ui = ui, server = server)
  </code></pre>
  <p>The problem is that all the blocks show the same text (the last one). and I don't understand why</p>
  <p>any ideas how to fix the code? what do I miss
  (shiny version 1.4.0)</p>