From the second time on when you click the button that opens the modal the modal opens showing the old data at first and then the update of the render-function is triggered.
library(shiny)
showMyModal <- function() {
showModal(
modalDialog(
verbatimTextOutput("mytext"),
footer = tagList(
modalButton("Dismiss"),
)
)
)
}
ui <- fluidPage(
actionButton("openDialog", "Open dialog")
)
server <- function(input, output, session) {
observeEvent(input$openDialog, {
showMyModal()
})
output$mytext <- renderPrint({
input$openDialog
})
}
shinyApp(ui = ui, server = server)
Is there a smart way to first update the modal UI and only afterwards opening the modal? I am looking for a way that the modal does not show outdated data before it gets refreshed.