Appsilon / shiny.router

A minimalistic router for your Shiny apps.
http://appsilon.github.io/shiny.router
Other
256 stars 31 forks source link

shiny.router 0.1.1 cannot work with R 3.5.0 or higher #51

Closed csliangy closed 6 years ago

csliangy commented 6 years ago

Thanks again for your great effort on shiny.router and it worked perfect on our application. But we came across a problem after upgrading to R3.5.0. We also tested the following sample application and we observe the same issue.

Source code:

library(shiny)
#devtools::install_github("Appsilon/shiny.router")
library(shiny.router)

# This generates menu in user interface with links.
menu <- (
  tags$ul(
    tags$li(a(class = "item", href = "/", "Page")),
    tags$li(a(class = "item", href = "/other", "Other"))
  )
)

# This creates UI for each page.
page <- function(title, content) {
  div(
    menu,
    titlePanel(title),
    p(content)
  )
}

# Both sample pages.
root_page <- page("Home page", "Welcome on sample routing page!")
other_page <- page("Some other page", "Lorem ipsum dolor sit amet")

# Creates router. We provide routing path and UI for this page.
router <- make_router(
  route("/", root_page),
  route("/other", other_page)
)

# Creat output for our router in main UI of Shiny app.
ui <- shinyUI(fluidPage(
  router_ui()
))

# Plug router into Shiny server.
server <- shinyServer(function(input, output) {
  router(input, output)
})

# Run server in a standard way.
shinyApp(ui, server)

R version: 3.5.0 or higher

image

Issues: When we click the "Other", it shows the following error: image

BTW, do you have plan to push it to CRAN?

krystian8207 commented 6 years ago

Hello @csliangy ! Thank you for using shiny.router.

To fix the application just make small changes:

menu <- (
  tags$ul(
    tags$li(a(class = "item", href = "/", "Page")),
    tags$li(a(class = "item", href = route_link("other"), "Other"))
  )
)

and:

router <- make_router(
  route("/", root_page),
  route("other", other_page)
)

The url no should have form: <app-url>/#!/other

The package is actually on CRAN since about one week. You can find info about latest features on our blog: https://appsilon.com/shiny-router-package/

csliangy commented 6 years ago

Fantastic!!! Thanks again. Actually we were using that for several projects and recently we moved it out of our projects due to the aforementioned problems. Now I have the full confidence to bring it back. Thanks again for your amazing contributions.

I was also impressed by https://www.r-bloggers.com/how-we-built-a-shiny-app-for-700-users/ .