From d4fd9d96188340c6324e34cc19a9e149853235d6 Mon Sep 17 00:00:00 2001 From: Carson Date: Tue, 15 Oct 2019 18:57:47 -0500 Subject: [PATCH] wrap user-supplied expression in local() instead of using shiny::installExprFunction() --- R/shiny.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/shiny.R b/R/shiny.R index f96779ccda..efb975e7ce 100644 --- a/R/shiny.R +++ b/R/shiny.R @@ -41,15 +41,15 @@ renderPlotly <- function(expr, env = parent.frame(), quoted = FALSE) { quoted <- TRUE expr <- substitute(expr) } - # Install the (user-supplied) expression as a function + # Wrap the (user-supplied) expression in local() # This way, if the user-supplied expression contains a return() # statement, we can capture that return value and pass it along # to prepareWidget() + expr <- call("local", expr, env) # prepareWidget() makes it possible to pass different non-plotly # objects to renderPlotly() (e.g., ggplot2, promises). It also is used # to inform event_data about what events have been registered - shiny::installExprFunction(expr, "func", env, quoted, assign.env = env) - expr <- quote(plotly:::prepareWidget(func())) + expr <- as.call(list(call(":::", quote("plotly"), quote("prepareWidget")), expr)) renderFunc <- shinyRenderWidget(expr, plotlyOutput, env, quoted) # remove 'internal' plotly attributes that are known to cause false # positive test results in shinytest (snapshotPreprocessOutput was added