shiny.fluent
shiny.fluent copied to clipboard
downloadHandler doesn’t work with shiny.fluent in R v4.2.2
It happens when we wrap the downloadButton()
in the Stack()
function from the shiny.fluent
package.
A minimal reprex
:
Directory tree:
.
├── app.R
└── modules
└── data_page.R
## app.R
box::use(
shiny[...],
shiny.fluent[...],
shiny.router[...],
modules / data_page
)
ui <- fluentPage(
router_ui(
route("/", data_page$ui("table"))
)
)
server <- function(input, output, session) {
router_server()
data_page$server("table")
}
# Create Shiny app ----
shinyApp(ui, server)
## data_page.R
box::use(
shiny[...],
shiny.fluent[...]
)
#' @export
ui <- function(id) {
ns <- NS(id)
fluentPage(
Stack(downloadButton(ns("download"), label = "Download Data"))
)
}
#' @export
server <- function(id) {
moduleServer(id, function(input, output, session) {
output$download <- downloadHandler(
filename = function() {
paste("data-", Sys.Date(), ".csv", sep = "")
},
content = function(file) {
utils::write.csv(datasets::iris, file)
}
)
})
}
─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
setting value
version R version 4.2.2 (2022-10-31)
os CentOS Linux 7 (Core)
system x86_64, linux-gnu
ui RStudio
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz America/New_York
date 2023-03-12
rstudio 2022.12.0+353.pro20 Elsbeth Geranium (server)
pandoc 2.19.2 @ /usr/local/bin/pandoc
─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
box 1.1.2 2022-05-11 [1] RSPM (R 4.2.0)
bslib 0.3.1 2021-10-06 [2] RSPM (R 4.2.0)
cachem 1.0.6 2021-08-19 [2] RSPM (R 4.2.0)
cli 3.4.1 2022-09-23 [2] RSPM (R 4.2.0)
digest 0.6.29 2021-12-01 [2] RSPM (R 4.2.0)
ellipsis 0.3.2 2021-04-29 [2] RSPM (R 4.2.0)
fastmap 1.1.0 2021-01-25 [2] RSPM (R 4.2.0)
fontawesome 0.2.2 2021-07-02 [2] RSPM (R 4.2.0)
glue 1.6.2 2022-02-24 [2] RSPM (R 4.2.0)
htmltools 0.5.2 2021-08-25 [2] RSPM (R 4.2.0)
httpuv 1.6.5 2022-01-05 [2] RSPM (R 4.2.0)
jquerylib 0.1.4 2021-04-26 [2] RSPM (R 4.2.0)
jsonlite 1.8.0 2022-02-22 [2] RSPM (R 4.2.0)
later 1.3.0 2021-08-18 [2] RSPM (R 4.2.0)
lifecycle 1.0.3 2022-10-07 [2] RSPM (R 4.2.0)
magrittr 2.0.3 2022-03-30 [2] RSPM (R 4.2.0)
mime 0.12 2021-09-28 [2] RSPM (R 4.2.0)
promises 1.2.0.1 2021-02-11 [2] RSPM (R 4.2.0)
R6 2.5.1 2021-08-19 [2] RSPM (R 4.2.0)
Rcpp 1.0.8.3 2022-03-17 [2] RSPM (R 4.2.0)
rlang 1.0.6 2022-09-24 [1] RSPM (R 4.2.0)
rstudioapi 0.13 2020-11-12 [2] RSPM (R 4.2.0)
sass 0.4.1 2022-03-23 [2] RSPM (R 4.2.0)
sessioninfo 1.2.2 2021-12-06 [2] RSPM (R 4.2.0)
shiny * 1.7.1 2021-10-02 [2] RSPM (R 4.2.0)
shiny.fluent 0.3.0 2023-01-24 [1] RSPM (R 4.2.0)
shiny.react 0.3.0 2022-12-25 [1] RSPM (R 4.2.0)
shiny.router 0.3.0 2023-03-02 [1] RSPM (R 4.2.0)
withr 2.5.0 2022-03-03 [2] RSPM (R 4.2.0)
xtable 1.8-4 2019-04-21 [2] RSPM (R 4.2.0)
[1] /home/shemo/R/x86_64-pc-linux-gnu-library/4.2
[2] /shared/R/site-library/4.2.0/library
[3] /opt/R/4.2.2/lib/R/library
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Hi @sahemo, download buttons are not supported by shiny.fluent yet. Please take advantage of this workaround until we implement this feature.
Hello @jakubsob
We are using the workaround already. It stopped working after we migrated to R 4.2.2
because it was wrapped in Stack()
. May be this is a different issue.
I agree with sahemo, it stopped working the workaround. And I am having a tough time finding a solution.
@alejandroLiqi I was running into the same issue this morning on 4.3 then I realized that had forgotten to call useShinyjs()
in my UI. Maybe you are running into a similar issue. The workaround still works for me.