Dhaval Mohandas
Dhaval Mohandas

Reputation: 73

Immediately seeing changes in R shiny UI, in the browser, after making changes in code without having to restart the server?

Is it possible to see the changes in UI (only the UI and not server) after I make changes in my code, without having to restart the server/refresh the page? If cache needs to be cleared, can that also be done?

Upvotes: 2

Views: 419

Answers (1)

HubertL
HubertL

Reputation: 19544

You could use reactiveFileReader to regularly source the code you'd save in another file, and renderUI()/uiOutput to display that dynamic UI:

app.R

library(shiny)

ui <- uiOutput("ui")

server <- function(input, output, session) {
  ui <- reactiveFileReader(1000, session, "source.R", source)
  output$ui <- renderUI(ui())
}

shinyApp(ui = ui, server = server)

source.R

fluidPage(
  textInput("text", "text"),
  textInput("text2", "text")
  )

You still have to find out howto get rid of that "TRUE": result

Upvotes: 2

Related Questions