myusrn
myusrn

Reputation: 1120

output shiny app object details in UI

My shiny app has a large cached object it is loading on startup, using readRDS(), that is leveraged in shinyServer() processing to populate shinyUI() defined textOutput().

Is there some trick to populating textOutput UI that says "loading cache object . . . " just before the readRDS() call and changes it to saying "loaded cache object of size, object.size(cacheLoadedObject)" once it has finished loading?

The reason this bit of UI behavior matters is the app input boxes will accept input prior to that object being loaded from disk but they are essentially not functional until it is as the reactive() and renderText() textOutput updates they trigger can't be calculated until that cached object is loaded.

Looked at "shiny app loading UI" hits and didn't find anything on this scenario.

Upvotes: 0

Views: 207

Answers (1)

Alexander Leow
Alexander Leow

Reputation: 466

You could use the shiny busy indicator to show some text while the object is loading. You may find the following links interesting:

shiny app busy indicator

http://deanattali.com/blog/advanced-shiny-tips/#busy-indicator

In addition you could hide/disable the input fields (using shinyjs) on loading and enabling them when loading is finished. See here for more information:

Disable textInput based on radio button selection on Shiny

https://rdrr.io/cran/shinyjs/man/disabled.html

Upvotes: 1

Related Questions