Why there is a TRUE in the bottom?

I'm trying to build an app to show different ui based on different conditions.

When I source a ui file, there is a TRUE printed after run the app. I don't want to see it.

https://shizidushu.shinyapps.io/true/

app.R

library(shiny)
library(shinydashboard)
ui <- source("ui-test.R")

server <- function(input, output) {
    
}

# Run the application 
shinyApp(ui = ui, server = server)

ui-test.R

dashboardPage(
  dashboardHeader(title = "dashboard", disable = TRUE),
  ## Sidebar content
  dashboardSidebar(
    sidebarMenu(
      menuItem("dashboard", tabName = "dashboard", icon = icon("dashboard"))
    ),
    collapsed = TRUE
  ),
  dashboardBody(
    fluidRow(
      
    )
  )
)

I found this answer on StackOverflow that seems to indicate it is due to the sourcing of the UI:

The answer seems to be to change ui <- source("ui-test.R") to ui <- source("ui-test.R", local = TRUE)$value

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.