Skip to content

Callback behavior changed with 0.2.2 #87

@haakonbuer

Description

@haakonbuer

Hi, I just recently updated to shiny.router 0.2.2 and noticed that for some dashboards where data fetching takes 10-15 seconds behavior has changed. Previously I would see the root page while the data loads, but now I get the 404 page while data loads.

I modified the basic app.R example code in order to create a reproducible example, with the following two changes:

# Callbacks on the server side for
# the sample pages
root_callback <- function(input, output, session) {
  
  ds <- reactive({
    # Adding a 5 second wait
    Sys.sleep(5)
    data.frame(x = c(1, 2), y = c(3, 4))
  })
  
  output$table_one <- renderDataTable({
    ds()
  })
}
# Creates router. We provide routing path, a UI as
# well as a server-side callback for each page.
router <- make_router(
  route("/", root_page, root_callback),
  route("other", other_page, other_callback),
  route("third", third_page, NA),
  page_404 = page404("You opened non existing bookmark!")
)

Now when the app starts off, the 404 page displays for 5 seconds, then the root page appears. In the previous version the root page would show while the root_callback finishes.

Screenshot 2021-07-06 141615

Is this expected, or is there a way to get the previous behavior back?

Session info attached:

sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] shiny.router_0.2.2 shiny_1.5.0       

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4.6    digest_0.6.25   withr_2.2.0     later_1.0.0     mime_0.9        R6_2.4.1        xtable_1.8-4    jsonlite_1.6.1 
 [9] magrittr_1.5    rlang_0.4.11    promises_1.1.0  tools_3.6.3     httpuv_1.5.2    fastmap_1.0.1   compiler_3.6.3  htmltools_0.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions