Skip to content

Commit c299c5f

Browse files
committed
Fix management of environments in renderPlotly(), fixes #1639
Both assignment and evaluation of func() should happen in the local environment
1 parent 4c0c7d8 commit c299c5f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

R/shiny.R

+3-2
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ renderPlotly <- function(expr, env = parent.frame(), quoted = FALSE) {
4848
# prepareWidget() makes it possible to pass different non-plotly
4949
# objects to renderPlotly() (e.g., ggplot2, promises). It also is used
5050
# to inform event_data about what events have been registered
51-
shiny::installExprFunction(expr, "func", env, quoted, assign.env = env)
51+
shiny::installExprFunction(expr, "func", env, quoted)
5252
expr <- quote(plotly:::prepareWidget(func()))
53-
renderFunc <- shinyRenderWidget(expr, plotlyOutput, env, quoted)
53+
local_env <- environment()
54+
renderFunc <- shinyRenderWidget(expr, plotlyOutput, local_env, quoted)
5455
# remove 'internal' plotly attributes that are known to cause false
5556
# positive test results in shinytest (snapshotPreprocessOutput was added
5657
# in shiny 1.0.3.9002, but we require >= 1.1)

0 commit comments

Comments
 (0)