I have an app with numerous (10+) selectizeInput()s each with 20,000+ choices. I have identified that these are the reason why my app currently takes ~30 seconds to load. All selectizeInputs appear on the second tab of a shinyDashboard, so users won't be interacting with them immediately when the app launches.
I would like to reduce launch time/lag as much as possible.
I have already:
- Moved the initialization of choices into the server as below, where new_choices is a single-column dataframe.
#UI:
selectizeInput("id","label", choices = NULL)
#Server:
updateSelectizeInput(session,"id", choices = new_choices)
- Attempted to set server = TRUE within updateSelectizeInput, but this results in a search-box that does not respond to any typing, as documented here:
https://github.com/rstudio/shiny/issues/1963
Any ideas if (2) above would actually speed things up? What is the expected behavior when we've set server=TRUE?
Is there a way to asynchronously load the UI elements that are not needed immediately on launch such that users can still interact with the app instead of waiting for all UI elements to load? I wouldn't want this to be triggered by an observeEvent that would just shift where the delay occurs. Rather, I'd want the UI elements to load while users interact with the first tab, so they are ready to go when they advance to the second tab.
Thank you!