thomasp85 / shinyFiles

A shiny extension for server side file access
196 stars 47 forks source link

Difference in coding between shinyFilesChoose and shinyFileSave #195

Open WilDoane opened 1 month ago

WilDoane commented 1 month ago

There appears to be a small difference between the implementations of shinyFilesChoose and shinyFileSave where Save causes immediate evaluation of the triple-dots (...) arguments.

Choose defers creating the fileGetter until sendDirectoryData is invoked while Save immediately (and outside a reactive context) creates the fileGetter, thereby causing the evaluation of the triple-dots (...) arguments.

Is there a reason for this? Is it necessary?

Because of this, these two similar functions have different performance behavior in server code: shinyFilesChoose can rely upon reactive expressions in the ... arguments while shinyFileSave cannot.

image

https://github.com/thomasp85/shinyFiles/blob/da361359712bbcd74dd6a9505a88ec87aead13bc/R/filechoose.R#L222

https://github.com/thomasp85/shinyFiles/blob/da361359712bbcd74dd6a9505a88ec87aead13bc/R/filesave.R#L29