Module NS behavior/input variable difference between RStudio Server and Connect

Having what looks like a race condition that varies between RStudio Server IDE, RStudio Connect, and Shiny Server open.

I can reproduce the issue on RStudio Connect, but not the other two.

To Reproduce, use the following app:

then rapidly create new tabs using the tab button.

On Shiny Server Pro/RStudio Server IDE I will generate distinct tabs no matter how fast I click.

On RStudio Connect, if I do it fast enough, I manage to generate NaN's for the input$add_tab

Which in turn results in tabs that link to the same content.

library(shiny)
library(shinydashboard)

# modularize tab
create_tab_ui = function(id) {
  ns = NS(id)
  
  tabPanel(title = paste("Game", id),
           sliderInput(ns("slider"), "slide me", 0, 100, 1),
           textOutput(ns("num")))
}

create_tab = function(input, output, session) {
  output$num = renderText({
    input$slider
    
  })
}


header = dashboardHeader(title = "Tabbed App", titleWidth = NULL)

sidebar = dashboardSidebar(disable = TRUE)

body = dashboardBody(tabBox(
  id = "tabs",
  width = 12,
  title = div(
    style = "display:inline-block;",
    actionButton(
      inputId = "add_tab",
      label = "New Tab",
      icon = icon("plus")
    )
  ),
  
  # initial tab
  create_tab_ui(id = 0)
))

ui = dashboardPage(
  skin = "blue",
  title = "Maggie",
  header = header,
  sidebar = sidebar,
  body = body
)

server = function(input, output, session) {
  
  # invoking initial tab
  callModule(module = create_tab, id = as.integer(0))
  
  # adding addtional tabs
  observeEvent(input$add_tab, {
    if(is.nan(input$add_tab)) {
      # LOG with print stuff, then check logs on rstudio connect
    }
    appendTab(
      inputId = "tabs",
      tab = create_tab_ui(id = as.integer(input$add_tab)),
      select = TRUE
    )
    
    
    callModule(module = create_tab, id = as.integer(input$add_tab))
    
  })
}

shinyApp(ui = ui, server = server)

Hi Nick,

Do you mind opening a support ticket for this issue? I think we'll need to dig into the versions of things in play to try and reproduce the issue.

Thanks,

Sean