Hi,
I am working on a desktop shiny app (based on this tutorial:
http://www.r-bloggers.com/deploying-desktop-apps-with-r/)
The app is rather big compared to other apps I see on the web and I get the feeling that it got a lot slower in the last few days when I added some more functionality.
Currently I can not share the code but I try to explain it as good as I can:
- sideBarPanel with 2 buttons for loading files, radio buttons, a selectChooser, a custom chooser (exactly this one:
https://github.com/rstudio/shiny-examples/blob/master/036-custom-input-control/chooser.R), sliderInput, actionButton
- mainPanel with 7 tabs
-> 2 have a data frame displaying loaded files, summaries, ...
-> 1 displays a plot
-> 2 have buttons to load, create, update files
-> 1 displays a result table (data frame)
-> 1 is just used to select to directories
Two things are really slow that bother me:
update* (TextInput, SelectInput, ...) takes a couple of seconds which was not the case before.
The file dialog of shinyFiles is really slow but I like to believe it's not the fault of the package because I would really like to use it.
Overall I use 2 conditional panels (I found this
https://groups.google.com/forum/#!topic/shiny-discuss/41xS0sCLl3w) but I think 2 should not be the issue.
I have several button+textInput combinations to show the selected file path implemented like this:
observe({
if (is.null(input$selectResultPath)) {
return()
}
rootDir<-parseDirPath(volumes, input$selectResultPath)
updateTextInput(session, 'resultDirPath', value=rootDir)
})
I'm not sure if this is the optimal implementation, maybe I should use reactive ?
I'm also not sure about the usage of shinyFiles, in the server.R I have it like this:
shinyFileChoose(input, "browse", roots=volumes, session = session, filetype=list(BED=c('bam')))
shinyFileChoose(input, "loadDB", roots=volumes, session = session, filetype=list(DB=c("RData")))
shinyFileSave(input, 'createDB', roots=volumes, session=session, restrictions=system.file(package='base'))
shinyFileChoose(input, 'selectBED', roots=volumes, session=session, filetype=list(BED=c('bed')))
shinyFileSave(input, 'extractGenes', roots=volumes, session=session, restrictions=system.file(package='base'))
shinyFileChoose(input, 'selectBED1', roots=volumes, session=session, filetype=list(BED=c('bed')))
shinyFileSave(input, 'selectBED2', roots=volumes, session=session, restrictions=system.file(package='base'))
shinyFileSave(input, 'export', roots=volumes, session=session, restrictions=system.file(package='base'))
shinyFileSave(input, 'savePDF', roots=volumes, session=session, restrictions=system.file(package='base'))
shinyDirChoose(input, 'selectRoot', roots=volumes, session=session)
shinyDirChoose(input, 'selectResultPath', roots=volumes, session=session)
And for all I have another observe block like above to do something with the selected path. Is that necessary/correct?
Things I did in the last days (since than I notice lags):
- I switched to package shinyFiles
- 3 of the tabs were added recently
- I added custom input bindings (
https://github.com/rstudio/shiny-examples/tree/master/035-custom-input-bindings) to my custom input control (mentioned above)
- changed from Windows 7 to Windows 10
I have no idea what of these things causes the problem, but I would love any solution that does not include removing shinyFiles, because every other file choosing option is painful :)
Best,
Verena