daattali / shinycssloaders

⌛ Add loading animations to a Shiny output while it's recalculating
https://daattali.com/shiny/shinycssloaders-demo/
Other
395 stars 45 forks source link

withSpinner not compatible with rendering in server #14

Closed dalekube closed 6 years ago

dalekube commented 6 years ago

I utilize modalDialog() in the server to have a screen pop-up with a visualization. The server includes a modalDialog(renderPlot()) call, and the plotOutput() UI element is not included/necessary. The withSpinner() function is not compatible as a wrapper to renderPlot(). For example, I cannot use modalDialog(withSpinner(renderPlot())). The following error message is produced:

Warning: Error in as.vector: cannot coerce type 'closure' to vector of type 'character'

Is there any workaround or hack to making this work?

andrewsali commented 6 years ago

What if you do: modalDialog(withSpinner(tagList(renderPlot()))) ?

If this works, one more recommendation: make sure you use the github version of shinycssloaders with modalDialog, it will work better than the one on CRAN.

dalekube commented 6 years ago

Yes, that works! Thank you. I had no idea tagList could be used like that.