Shiny dashboard not displaying all widgets


#1

Hi, I’m trying to debug a Shinydashboard app. Most of the app is working fine, but a couple of tabs with multiple widgets (mostly a mix of infoBox, valueBox, and text boxes) is not rendering all of the boxes, and I can’t figure out why. (Typically, one or two boxes will render, but the rest will be totally missing.) I’ve turned on shiny.trace, and can see correct-looking payload being sent to the client. On the client, in the JS console, I can see a bunch of errors that look like this:


htmlwidgets.js:475 Uncaught TypeError: Cannot read property 'filter' of undefined
    at exports.OutputBinding.shinyBinding.find (htmlwidgets.js:475)
    at a (init_shiny.js:15)
    at f (init_shiny.js:215)
    at Object.exports.bindAll (init_shiny.js:225)
    at Object.exports.renderContent (output_binding_html.js:51)
    at exports.OutputBinding.renderValue (output_binding_html.js:14)
    at exports.OutputBinding.onValueChange (output_binding.js:16)
    at OutputBindingAdapter.onValueChange (output_binding_adapter.js:21)
    at ShinyApp.receiveOutput (shinyapp.js:350)
    at ShinyApp.<anonymous> (shinyapp.js:562)
shinyBinding.find @ htmlwidgets.js:475
a @ init_shiny.js:15
f @ init_shiny.js:215
exports.bindAll @ init_shiny.js:225
exports.renderContent @ output_binding_html.js:51
renderValue @ output_binding_html.js:14
onValueChange @ output_binding.js:16
onValueChange @ output_binding_adapter.js:21
receiveOutput @ shinyapp.js:350
(anonymous) @ shinyapp.js:562
_sendMessagesToHandlers @ shinyapp.js:547
dispatchMessage @ shinyapp.js:533
c.onmessage @ shinyapp.js:112
4app.js:279 Uncaught TypeError: Cannot read property 'options' of undefined
    at Object.fix (app.js:279)
    at app.js:252
    at dispatch (jquery.min.js:3)
    at r.handle (jquery.min.js:3)

My sessionInfo is:

R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin16.7.0 (64-bit)
Running under: macOS High Sierra 10.13.2

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
 [1] bindrcpp_0.2         rredis_1.7.0         glue_1.2.0           jsonlite_1.5        
 [5] httr_1.3.1           pool_0.1.3           dbplyr_1.1.0         DBI_0.7-12          
 [9] DT_0.2               lubridate_1.7.1      magrittr_1.5         forcats_0.2.0       
[13] dplyr_0.7.4          purrr_0.2.4          readr_1.1.1          tidyr_0.7.2         
[17] tibble_1.3.4         ggplot2_2.2.1        tidyverse_1.2.1      stringr_1.2.0       
[21] shinyBS_0.61         shinydashboard_0.6.1 shiny_1.0.5         

loaded via a namespace (and not attached):
 [1] bit64_0.9-7         splines_3.4.2       modelr_0.1.1        Formula_1.2-2       assertthat_0.2.0   
 [6] latticeExtra_0.6-28 blob_1.1.0          cellranger_1.1.0    yaml_2.1.16         backports_1.1.2    
[11] lattice_0.20-35     digest_0.6.13       RColorBrewer_1.1-2  checkmate_1.8.5     rvest_0.3.2        
[16] colorspace_1.3-2    htmltools_0.3.6     httpuv_1.3.5        Matrix_1.2-12       plyr_1.8.4         
[21] psych_1.7.8         pkgconfig_2.0.1     RPostgres_1.0-3     broom_0.4.3         haven_1.1.0        
[26] xtable_1.8-2        scales_0.5.0        later_0.6           htmlTable_1.11.0    nnet_7.3-12        
[31] lazyeval_0.2.1      cli_1.0.0           mnormt_1.5-5        survival_2.41-3     crayon_1.3.4       
[36] readxl_1.0.0        mime_0.5            nlme_3.1-131        xml2_1.1.1          foreign_0.8-69     
[41] tools_3.4.2         data.table_1.10.4-3 hms_0.4.0           munsell_0.4.3       cluster_2.0.6      
[46] compiler_3.4.2      rlang_0.1.4         grid_3.4.2          rstudioapi_0.7      htmlwidgets_0.9    
[51] base64enc_0.1-3     gtable_0.2.0        curl_3.1            reshape2_1.4.3      R6_2.2.2           
[56] gridExtra_2.3       knitr_1.17          bit_1.1-12          bindr_0.1           Hmisc_4.0-3        
[61] stringi_1.1.6       parallel_3.4.2      Rcpp_0.12.14        rpart_4.1-11        acepack_1.4.1  

Chrome Version 63.0.3239.108 (Official Build) (64-bit), and identical issue on Safari.

Some Googling suggests that errors like this have happened due to htmlwidgets and/or DataTable errors.


#6

Crossposted to SO: https://stackoverflow.com/questions/47877749/shiny-app-not-displaying-widgets-in-ui


#7

OK, I’ve figured it out. I was using this trick to render Markdown documentation into HTML, which I was importing as a “Help” page. Pandoc seems to include a bunch of Javascript, and presumably some of that caused this issue.

I’ll have to find another solution to my documentation issue… :frowning: But, my app is working again! :slight_smile:


#8

Ooh, interesting! I…might need to learn more about pandoc, which is slightly terrifying, but I’ve run into similar scenarios where an inordinate amount of JS gets involved for seemingly minor pandoc reasons.

strikes again!


#9

Yes, that! :slight_smile:

Maybe someone could write an htmlwidgets wrapper for showdown?


#10

Way out of my league! Though I wouldn’t put it past timelyportfolio!


#11

Maybe shiny::includeMarkdown? Since this function predates the rmarkdown package, it uses the markdown package to render md to html, which should be more lightweight.


#12

Oh, thank you, Joe! I missed that as an option! It seems to work fine…