rstudio/shiny — pull request #108 by wch (2013-02-18 21:56:23+00:00)
Title: Treat unused outputs as hidden

This change treats unused output objects as hidden. Previously, they weren't treated as hidden or non-hidden.

Test case for posterity:

```r
options(shiny.trace = TRUE)

# shinyRun function from:
# https://gist.github.com/wch/1bab36af24754a896293
source_gist('1bab36af24754a896293')

shinyRun(
#--------------------------------------------------------------
`server.R` = quote({
shinyServer(function(input, output) {
data <- reactive({
dist <- switch(input$dist, norm = rnorm, unif = runif, lnorm = rlnorm,
exp = rexp,rnorm)
dist(input$n)
})

output$plot <- renderPlot({ hist(data()) })
output$summary <- renderPrint({ summary(data()) })
output$table <- renderTable({ data.frame(x=data()) })

# Unused output object
output$foo <- reactive({ cat("foo\n") })

# NOTE: uncomment this to test suspendWhenHidden option
# outputOptions(output, 'foo', suspendWhenHidden = FALSE)
})
}),
#--------------------------------------------------------------
`ui.R` = quote({
shinyUI(pageWithSidebar(
headerPanel("Tabsets"),
sidebarPanel(
radioButtons("dist", "Distribution type:",
c("Normal" = "norm", "Uniform" = "unif")),
br(),
sliderInput("n", "Number of observations:", value = 500, min = 1, max = 1000)
),
mainPanel(
tabsetPanel(
tabPanel("Plot", plotOutput("plot")),
tabPanel("Summary", verbatimTextOutput("summary")),
tabPanel("Table", tableOutput("table"))
)
)
))
})
)
```