I have many outputOptions setting suspendWhenHidden = FALSE
outputOptions(output, "renderui_1", suspendWhenHidden = FALSE)
outputOptions(output, "renderui_2", suspendWhenHidden = FALSE)
...
outputOptions(output, "renderui_N", suspendWhenHidden = FALSE)
This takes a lot of time
Is it possible to make this more efficient?
Didn't found it in documentation but I still haven't tried something like
outputOptions(output, c("renderui_1","renderui_2",...,"renderui_N"), suspendWhenHidden = FALSE)
Any help is appreciated
you can use purrr::walk like so
library(shiny)
ui <- fluidPage(
verbatimTextOutput("tout"),
uiOutput("renderui_1"),
uiOutput("renderui_2")
)
server <- function(input, output, session) {
output$renderui_1 <- renderUI({
p("some ui")
})
output$renderui_2 <- renderUI({
p("more ui")
})
purrr::walk(paste0("renderui_",1:2),\(x){outputOptions(output,
x,
suspendWhenHidden = FALSE)})
output$tout <- renderText({
capture.output(outputOptions(output))
})
}
shinyApp(ui, server)
1 Like
thank you
that helps
also testing lapply'ing to the list of outputs to compare.