Не совсем ответ, я знаю, но я не очень понимаю, почему не работает следующее. Это обеспечивает правильный порядок выполнения, но проблема сохраняется. Я полагаю, проблема в том, что обновления не сбрасываются до того, как оба закончат работу.
server <- function(input, output,session) {
rv <- reactiveValues(goPlot_wait = 0)
observeEvent(input$goPlot,{
cat("A EXECUTED\n")
updateTabsetPanel(session, "inTabset", selected = 'Summary')
rv$goPlot_wait <- rv$goPlot_wait + 1
})
observeEvent(rv$goPlot_wait,{
if(rv$goPlot_wait == 0) {
return()
}
cat("B EXECUTED\n")
output$plot <- renderPlot({
# Create 0-row data frame which will be used to store data
dat <- data.frame(x = numeric(0), y = numeric(0))
withProgress(message = 'Making plot', value = 0, {
# Number of times we'll go through the loop
n <- 10
for (i in 1:n) {
# Each time through the loop, add another row of data. This is
# a stand-in for a long-running computation.
dat <- rbind(dat, data.frame(x = rnorm(1), y = rnorm(1)))
# Increment the progress bar, and update the detail text.
incProgress(1/n, detail = paste("Doing part", i))
# Pause for 0.1 seconds to simulate a long computation.
Sys.sleep(0.25)
}
})
plot(dat$x, dat$y)
})
})
}
ui <- shinyUI(fluidPage(
actionButton('goPlot', 'Go plot'),
tabsetPanel(id = "inTabset",
tabPanel("Plot", plotOutput("plot")),
tabPanel("Summary"))))
shinyApp(ui = ui, server = server)
При запуске этого приложения и нажатии кнопки я получаю:
> shinyApp(ui = ui, server = server)
Listening on http://127.0.0.1:6800
A EXECUTED
B EXECUTED
Тем не менее, вкладка обновляется после графика. Возможно, кто-то может пролить свет на то, что здесь происходит.