Here's a reproducible example :
library(shiny)
library(shinyAce)
library(clipr)
init <- "text 1"
tab <- "text 2"
ui <- shinyUI(pageWithSidebar(
headerPanel("title"),
sidebarPanel(),
mainPanel(
checkboxInput("tableau", "Text 2", FALSE),
br(),
actionButton("copy", "Copy", width = '100%'),
aceEditor(
outputId = "ace",
mode = "r",
theme = "chrome",
readOnly = TRUE,
selectionId = init
)
)
)
)
server <- shinyServer(function(input, output, session) {
observe({
cat(input$ace, "\n")
})
observeEvent(input$copy, {
write_clip(input$ace, object_type = "character")
})
observe({
if (input$tableau) {
updateAceEditor(session, "ace", value = tab)
} else {
updateAceEditor(session, "ace", value = init)
}
})
})
shinyApp(ui = ui, server = server)
It automatically quits when I click on "Copy" and I have the error message I posted above. And indeed, users are disconnected when they click on it in the deployed version.