Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defer creation of fileGetter and dirCreator to allow reactive expressions #196

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# shinyFiles (development version)

* Accepted pull request from @WilDoane to address #195

# shinyFiles 0.9.4

* Fixed #185 (@pietrodita)
Expand Down
6 changes: 4 additions & 2 deletions R/filesave.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ NULL
#'
shinyFileSave <- function(input, id, updateFreq = 0, session = getSession(),
defaultPath = "", defaultRoot = NULL, allowDirCreate = TRUE, ...) {
fileGet <- do.call(fileGetter, list(...))
dirCreate <- do.call(dirCreator, list(...))
currentDir <- list()
lastDirCreate <- NULL
clientId <- session$ns(id)
Expand All @@ -39,6 +37,10 @@ shinyFileSave <- function(input, id, updateFreq = 0, session = getSession(),
dir <- input[[paste0(id, "-modal")]]
createDir <- input[[paste0(id, "-newDir")]]

## allows reactive links (e.g., for filetypes)
fileGet <- do.call(fileGetter, list(...))
dirCreate <- do.call(dirCreator, list(...))

# Show a notification if a user is trying to create a
# new directory when that option has been disabled
if (!identical(createDir, lastDirCreate)) {
Expand Down