Skip to content

Commit 6e1a4c2

Browse files
BUGFIX: crash when .compare and .updateInputs where used together
1 parent e282154 commit 6e1a4c2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

R/controlsUtils.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ resetInitValues <- function(controls, values, newParams = NULL) {
223223
# - ind: list of individual controls for the first chart to compare
224224
# - ind2: list of individual controls for the seconde chart to compare
225225
comparisonControls <- function(controls, compare, updateInputs = NULL, env) {
226-
if (length(controls) == 0) return(list())
226+
if (length(controls) == 0) return(list(common = list(), ind1 = list(), ind2 = list()))
227227
common <- filterControls(controls, names(compare), drop = TRUE)
228228
ind <- filterControls(controls, names(compare))
229229
ind2 <- ind

R/mwServer.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ updateInputs <- function(session, input, controlDesc, .display, .compare, .updat
146146
newParams <- eval(.updateInputs, envir = env)
147147

148148
for (n in names(newParams)) {
149-
inputId <- paste0(n, suffix)
149+
# TODO: in comparison mode, common inputs are updated twice.
150+
if (n %in% names(.compare)) inputId <- paste0(n, suffix)
151+
else inputId <- n
150152
desc <- controlDesc[controlDesc$name == inputId,]
151153
updateInputFun <- switch(
152154
desc$type,

0 commit comments

Comments
 (0)