shinyUI() and shinyServe() functions - are they ever needed?


#1

I remember in the old days, shinyUI() and shinyServer() were required when building apps.

I’ve stopped using them long ago, but I still see many people use them.

Looking at the actual function bodies, it looks like all they do is set the .globals$ui/server variable. When looking at the shiny codebase, I only found one place where that’s used: https://github.com/rstudio/shiny/blob/aff3ac0bb3b471a2e5a73d0423ee7ee3d896604c/R/app.R#L154-L161

I didn’t understand why it’s used there, but I was wondering if there is ever a reason to use them?


#2

I don’t think so; I think we only keep them around for backward compatibility purposes… At least, I’ve never found a situation where I’ve needed them.


#3

They’re totally vestigial at this point. The only reason they ever existed was because I didn’t know at the time that you could retrieve the last expression from a source()’d file.


#4

Great, I can use this thread as proof every time I try to convince someone that they’re not needed :slight_smile:

Is there a reason these two functions still have the .globals variable setting, is the one place in the code that still uses .globals$ui important?