Updates and method calls – update_vue(), call_vue(), every
update_el_*() and call_el() – are sent as Shiny's own
update*Input() are: with the flush, once the observer that made them,
and the rest of the flush, is done. An update made before a long
computation in the same observer therefore shows after it.
flush_vue() sends them at once: wrapped around the updates, it runs
them and sends what is queued; called alone, it sends what is queued so
far.
Usage
flush_vue(expr = NULL, session = shiny::getDefaultReactiveDomain())Details
Often there is a better way: a long computation in an
shiny::ExtendedTask leaves the observer at once, and the update goes
with that flush. A component library may send some updates at once by
their nature – a progress bar, as shiny::withProgress() does.
Only the components' messages are sent: outputs are still calculated with the flush, as Shiny does.
Examples
if (interactive()) {
# inside a server function
observeEvent(input$run, {
flush_vue({
update_el_table(session, "tbl", loading = TRUE)
})
result <- slow_query()
update_el_table(session, "tbl", data = result, loading = FALSE)
})
}