diff --git a/app.R b/app.R index 302539f..52ed23b 100644 --- a/app.R +++ b/app.R @@ -17,13 +17,23 @@ if (shows %>% names %>% is.na %>% which %>% length > 0) ui <- fluidPage( inputPanel(width = "20%", height = "100%", h1("GraphTV"), - selectizeInput("show", "Search show", shows, selected = "tt0944947", width = "600px") + selectizeInput("show", "Search show", NULL, width = "600px") ), plotlyOutput("show_graph", width = "100%", height = "800px") ) server <- function(input, output, session) { + observe({ + queryString <- getQueryString(session) + selected <- ifelse(queryString$show %>% is.null, "tt0944947", queryString$show) + updateSelectizeInput(session, "show", choices = shows, selected = selected, server = T) + }) + + observe({ + updateQueryString(str_c("?show=", input$show), "replace", session) + }) + output$show_graph <- renderPlotly({ req(input$show)