remove setLabel from ReactiveValues

This commit is contained in:
Barret Schloerke
2018-12-13 14:42:25 -05:00
parent 3eb55e9d9b
commit 81de1c8ed4
3 changed files with 8 additions and 55 deletions

View File

@@ -212,32 +212,6 @@ RLog <- R6Class(
self$define(self$keyIdStr(reactId, key), self$keyIdStr(label, key), "reactiveValuesKey", domain)
},
updateReactLabel = function(reactId, label, domain) {
msgObj <- msg$getReact(reactId)
if (!is.null(msgObj)) {
msgObj$label <- label
msg$setReact(msgObj)
}
msg$log("updateLabel:", msg$reactStr(reactId))
private$appendEntry(domain, list(
action = "updateLabel",
reactId = reactId,
label = label
))
},
updateReactLabelNames = function(reactId, label, domain) {
self$updateReactLabel(self$namesIdStr(reactId), self$namesIdStr(label), domain)
},
updateReactLabelAsList = function(reactId, label, domain) {
self$updateReactLabel(self$asListIdStr(reactId), self$asListIdStr(label), domain)
},
updateReactLabelAsListAll = function(reactId, label, domain) {
self$updateReactLabel(self$asListAllIdStr(reactId), self$asListAllIdStr(label), domain)
},
updateReactLabelKey = function(reactId, key, label, domain) {
self$updateReactLabel(self$keyIdStr(reactId, key), self$keyIdStr(label, key), domain)
},
dependsOn = function(reactId, depOnReactId, ctxId, domain) {
if (is.null(reactId)) return()
ctxId <- ctxIdStr(ctxId)

View File

@@ -306,11 +306,12 @@ ReactiveValues <- R6Class(
.hasRetrieved = list(),
initialize = function(dedupe = TRUE) {
initialize = function(
dedupe = TRUE,
label = paste0('reactiveValues', p_randomInt(1000, 10000))
) {
.reactId <<- nextGlobalReactId()
.label <<- paste('reactiveValues',
p_randomInt(1000, 10000),
sep="")
.label <<- label
.values <<- new.env(parent=emptyenv())
.metadata <<- new.env(parent=emptyenv())
.dependents <<- new.env(parent=emptyenv())
@@ -509,23 +510,8 @@ ReactiveValues <- R6Class(
.valuesDeps$register()
return(listValue)
},
.setLabel = function(label) {
domain <- getDefaultReactiveDomain()
if (isTRUE(.hasRetrieved$names))
rLog$updateReactLabelNames(.reactId, label, domain)
if (isTRUE(.hasRetrieved$asList))
rLog$updateReactLabelAsList(.reactId, label, domain)
if (isTRUE(.hasRetrieved$asListAll))
rLog$updateReactLabelAsListAll(.reactId, label, domain)
for (key in .hasRetrieved$keys) {
if (isTRUE(.hasRetrieved$keys[[key]])) {
rLog$updateReactLabelKey(.reactId, key, label, domain)
}
}
.label <<- label
}
)
)
@@ -674,11 +660,6 @@ as.list.reactivevalues <- function(x, all.names=FALSE, ...) {
reactiveValuesToList(x, all.names)
}
# For debug purposes
.setLabel <- function(x, label) {
.subset2(x, 'impl')$.setLabel(label)
}
#' Convert a reactivevalues object to a list
#'
#' This function does something similar to what you might \code{\link[base]{as.list}}

View File

@@ -750,8 +750,8 @@ ShinySession <- R6Class(
private$flushCallbacks <- Callbacks$new()
private$flushedCallbacks <- Callbacks$new()
private$inputReceivedCallbacks <- Callbacks$new()
private$.input <- ReactiveValues$new(dedupe = FALSE)
private$.clientData <- ReactiveValues$new(dedupe = TRUE)
private$.input <- ReactiveValues$new(dedupe = FALSE, label = "input")
private$.clientData <- ReactiveValues$new(dedupe = TRUE, label = "clientData")
private$timingRecorder <- ShinyServerTimingRecorder$new()
self$progressStack <- Stack$new()
self$files <- Map$new()
@@ -759,9 +759,7 @@ ShinySession <- R6Class(
self$userData <- new.env(parent = emptyenv())
self$input <- .createReactiveValues(private$.input, readonly=TRUE)
.setLabel(self$input, 'input')
self$clientData <- .createReactiveValues(private$.clientData, readonly=TRUE)
.setLabel(self$clientData, 'clientData')
self$output <- .createOutputWriter(self)