daattali / shinycssloaders

⌛ Add loading animations to a Shiny output while it's recalculating
https://daattali.com/shiny/shinycssloaders-demo/
Other
399 stars 45 forks source link

JavaScript error caused by unescaped selector when used with Shiny bookmark feature #16

Closed fmannhardt closed 4 years ago

fmannhardt commented 6 years ago

Since recently, probably due to a Shiny update, I get the following JavaScript syntax error when using shinycssloaders:

Uncaught Error: Syntax error, unrecognized expression: #.bookmark at Function.fa.error (jquery.min.js:2) at fa.tokenize (jquery.min.js:2) at fa.select (jquery.min.js:2) at Function.fa [as find] (jquery.min.js:2) at n.fn.init.find (jquery.min.js:2) at new n.fn.init (jquery.min.js:2) at n (jquery.min.js:2) at show_spinner (spinner.js:5) at update_spinner (spinner.js:23) at HTMLDocument. (spinner.js:34) init_shiny.js:314 Uncaught TypeError: Cannot read property 'normalCall' of undefined at k (init_shiny.js:314) init_shiny.js:381 Uncaught TypeError: Cannot read property 'normalCall' of undefined at n (init_shiny.js:381)

A similar error was reported here: rstudio/shinytest#161

So, probably it can be solved by escaping the IDs in a similar way in spinner.js.

I did not have the time to create a reproducible example, but here my session info:

R version 3.4.4 (2018-03-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=Norwegian Bokmål_Norway.1252  LC_CTYPE=Norwegian Bokmål_Norway.1252    LC_MONETARY=Norwegian Bokmål_Norway.1252 LC_NUMERIC=C                            
[5] LC_TIME=Norwegian Bokmål_Norway.1252    

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

other attached packages:
 [1] RPostgres_1.1.1            DBI_1.0.0                  processanimateR_0.1.2.9000 lubridate_1.7.4            svgPanZoom_0.3.3           DiagrammeRsvg_0.1         
 [7] DiagrammeR_1.0.0           xesreadR_0.2.2             processmapR_0.3.1          eventdataR_0.2.0           edeaR_0.8.0                bupaR_0.4.0.9000          
[13] RColorBrewer_1.1-2         magrittr_1.5               fastmatch_1.1-0            Cairo_1.5-9                DT_0.4                     shinycssloaders_0.2.0     
[19] shinyBS_0.61               shinyWidgets_0.4.3         dbplyr_1.2.1               forcats_0.3.0              stringr_1.3.1              dplyr_0.7.5               
[25] purrr_0.2.5                readr_1.1.1                tidyr_0.8.1                tibble_1.4.2               ggplot2_2.2.1.9000         tidyverse_1.2.1           
[31] scales_0.5.0.9000          rlang_0.2.1                shiny_1.1.0               

loaded via a namespace (and not attached):
 [1] nlme_3.1-131.1    bit64_0.9-7       httr_1.3.1        profvis_0.3.5     tools_3.4.4       R6_2.2.2          lazyeval_0.2.1    colorspace_1.3-2  tidyselect_0.2.4  gridExtra_2.3    
[11] mnormt_1.5-5      bit_1.1-14        curl_3.2          compiler_3.4.4    cli_1.0.0         rvest_0.3.2       xml2_1.2.0        influenceR_0.1.0  plotly_4.7.1      psych_1.8.4      
[21] digest_0.6.15     foreign_0.8-69    pkgconfig_2.0.1   htmltools_0.3.6   htmlwidgets_1.2   ggthemes_3.5.0    readxl_1.1.0      rstudioapi_0.7    bindr_0.1.1       visNetwork_2.0.3 
[31] jsonlite_1.5      crosstalk_1.0.0   rgexf_0.15.3      Rcpp_0.12.17      munsell_0.4.3     viridis_0.5.1     stringi_1.1.7     yaml_2.1.19       plyr_1.8.4        shinyTime_0.2.1  
[41] blob_1.1.1        grid_3.4.4        parallel_3.4.4    promises_1.0.1    crayon_1.3.4      miniUI_0.1.1.1    lattice_0.20-35   haven_1.1.1       hms_0.4.2         pillar_1.2.3     
[51] igraph_1.2.1      reshape2_1.4.3    XML_3.98-1.11     glue_1.2.0        V8_1.5            downloader_0.4    data.table_1.11.4 modelr_0.1.2      httpuv_1.4.3      cellranger_1.1.0 
[61] gtable_0.2.0      assertthat_0.2.0  mime_0.5          xtable_1.8-2      broom_0.4.4       later_0.7.2       viridisLite_0.3.0 bindrcpp_0.2.2    Rook_1.1-1        brew_1.0-6   
andrewsali commented 6 years ago

Thanks for reporting this! I have copied the fix you referenced, could you try it by installing it via:

devtools::install_github("andrewsali/shinycssloaders@escape")
fmannhardt commented 6 years ago

Thanks with the fix it works for me now.

merlinoa commented 5 years ago

@andrewsali thanks for this great package.

I ran into this same issue, and your fix here resolved the issue. Do you plan to merge the "escape" branch with master? I can make the PR.

andrewsali commented 5 years ago

Yes, a PR would be appreciated, thanks!

On Tue, Mar 12, 2019 at 7:36 PM Andy Merlino notifications@github.com wrote:

@andrewsali https://github.com/andrewsali thanks for this great package.

I ran into this same issue, and your fix here resolved the issue. Do you plan to merge the "escape" branch with master? I can make the PR.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/andrewsali/shinycssloaders/issues/16#issuecomment-472129188, or mute the thread https://github.com/notifications/unsubscribe-auth/AOYYp8E3Wb-xZiWUQw88GvY62dS1EjCVks5vV_OVgaJpZM4Uas2o .

daattali commented 4 years ago

This is now on CRAN, thanks @merlinoa