I am using progressSweetAlert and passing a shiny.tag into the title. That works because progressSweetAlert actually calls sendSweetAlert and uses insertUI to display the progressBar. The thing is that when I try to pass another shiny.tag in the title parameter of the updateProgressBar function, the messageHandler tries to parse it as a literal character so [object Object] is displayed.
I know that there are alternative solutions to achieve this, but I wanted to ask the following questions:
- Should updateProgress throw an error when shiny.tags are used in its arguments?
- It's feasible to implement an html argument like the one sendSweetAlert has?
- What are your thoughts about this?
Here's a reprex:
box::use(
shiny[...],
shinyWidgets[
progressSweetAlert, closeSweetAlert, useSweetAlert, updateProgressBar
]
)
ui <- fluidPage(
useSweetAlert(),
actionButton("btn", "Click me")
)
server <- function(input, output, session) {
observeEvent(input$btn, {
progressSweetAlert(
id = "progress",
title = tagList("Progress", icon("spinner", class = "fa-spin")),
value = 0
)
Sys.sleep(1)
updateProgressBar(
id = "progress",
value = 50,
title = tagList("Progress 2", icon("check", class = "fa-spin")),
)
Sys.sleep(2)
closeSweetAlert(session)
})
}
shinyApp(ui, server)
sessionInfo
R version 4.3.2 (2023-10-31)
Platform: aarch64-unknown-linux-gnu (64-bit)
Running under: Ubuntu 22.04.3 LTS
Matrix products: default
BLAS: /usr/lib/aarch64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/aarch64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
time zone: Etc/UTC
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices datasets utils methods
[7] base
other attached packages:
[1] shiny_1.8.0
loaded via a namespace (and not attached):
[1] digest_0.6.33 shinyWidgets_0.8.0 later_1.3.2
[4] R6_2.5.1 httpuv_1.6.13 fastmap_1.1.1
[7] fontawesome_0.5.2 magrittr_2.0.3 cachem_1.0.8
[10] memoise_2.0.1 htmltools_0.5.7 lifecycle_1.0.4
[13] promises_1.2.1 cli_3.6.2 xtable_1.8-4
[16] sass_0.4.8 jquerylib_0.1.4 renv_1.0.3
[19] compiler_4.3.2 tools_4.3.2 bslib_0.6.1
[22] ellipsis_0.3.2 mime_0.12 Rcpp_1.0.11
[25] rlang_1.1.2 jsonlite_1.8.8 box_1.1.3
Thanks
I am using progressSweetAlert and passing a shiny.tag into the title. That works because progressSweetAlert actually calls sendSweetAlert and uses insertUI to display the progressBar. The thing is that when I try to pass another shiny.tag in the title parameter of the updateProgressBar function, the messageHandler tries to parse it as a literal character so [object Object] is displayed.
I know that there are alternative solutions to achieve this, but I wanted to ask the following questions:
Here's a reprex:
sessionInfo
Thanks