rstudio / connectwidgets

The {connectwidgets} package allows you to curate your content on RStudio Connect, helping to create organized groups of content within an RMarkdown document or Shiny app.
https://rstudio.github.io/connectwidgets/
Other
21 stars 7 forks source link

Grid does not update when used inside a Shiny app #56

Open edgararuiz opened 3 years ago

edgararuiz commented 3 years ago

Reprex:

library(shiny)
library(connectwidgets)
library(dplyr)

connect_server <- Sys.getenv("CONNECT_SERVER")
connect_key <- Sys.getenv("CONNECT_API_KEY")
client <- connect(server  = connect_server, api_key = connect_key)
all_content <- content(client)   

app_modes <- all_content %>% 
  group_by(app_mode) %>% 
  summarise() %>% 
  pull()

ui <- fluidPage(
  radioButtons("type", label = "Type", choices = app_modes),
  rscgridOutput("grid")
)

server <- function(input, output, session) {
  output$grid <- renderRscgrid({
    all_content %>% 
      filter(app_mode == input$type) %>% 
      head(10) %>% 
      rsc_grid()
  })
}
shinyApp(ui = ui, server = server)