flexdashboard icon indicating copy to clipboard operation
flexdashboard copied to clipboard

Flexdashboard doesn't work with Shiny URL state.

Open asoftoday opened this issue 7 years ago • 4 comments

I am trying to combine flexdashboard with Shiny state bookmarking. When used alone (example from the docs) Shiny app works fine, but when put in flexdasboard, url is not updated:

---
title: "Untitled"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    runtime: shiny
---

```{r setup, include=FALSE}
library(flexdashboard)
```

Column {data-width=650}
-----------------------------------------------------------------------

### Chart A

```{r}

shinyApp(
  ui=function(req) {
    fluidPage(
      textInput("txt", "Text"),
      checkboxInput("chk", "Checkbox")
    )
  },
  server=function(input, output, session) {
    observe({
      # Trigger this observer every time an input changes
      reactiveValuesToList(input)
      session$doBookmark()
    })
    onBookmarked(function(url) {
      updateQueryString(url)
    })
  },
  enableBookmarking = "url")
```

Is this even possible?

asoftoday avatar Nov 16 '17 19:11 asoftoday

I have the same question. Can anyone answer that? Thank you!

jji-csc avatar Jun 20 '18 18:06 jji-csc

I posted same question in the RStudio Community. State (bookmark) for markdown+shiny (or flexdashboard) was working until few weeks ago. Did something change?

maxmoro avatar Jun 20 '18 19:06 maxmoro

I am also unable to bookmark the shiny state in flexdashboard.

You can try it out here:

http://colorado.rstudio.com:3939/content/1120/

If you choose certain inputs, you will get a bookmark URL, but that URL will not return the selected inputs:

http://colorado.rstudio.com/rsc/tracker-dash/?inputs&grp=%22Core%22&per=%22YTD%22&seg=%22Mainstream%22

I would have expected the URL above to return a shiny app for Core/YTD/Mainstream inputs. Instead it returns the default inputs.

Update: I had to remove the bookmark from the example above, so this is no longer an example of the problem.

nwstephens avatar Jul 18 '18 02:07 nwstephens

Ran into this issue also but found a workaround

From https://cran.r-project.org/src/contrib/Archive/shiny/ previous versions 1.0.3

You can do it like so

download.file("http://cran.r-project.org/src/contrib/Archive/shiny/shiny_1.0.3.tar.gz",
+    dest="shiny_1.0.3.tar.gz")
install.packages("shiny_1.0.3.tar.gz",repos=NULL,type="source")

Duly noted you will have to test your dashboard. I found that the last couple of plotly package versions depends one of the newer-ish versions of shiny (1.0.5)

pkopps avatar Aug 10 '18 15:08 pkopps