@@ -37,17 +37,21 @@ plotlyOutput <- function(outputId, width = "100%", height = "400px",
3737# ' @rdname plotly-shiny
3838# ' @export
3939renderPlotly <- function (expr , env = parent.frame(), quoted = FALSE ) {
40- if (! quoted ) { expr <- substitute(expr ) } # force quoted
41- # Wrap the (user-supplied) expression with a call to evalq()
40+ if (! quoted ) {
41+ quoted <- TRUE
42+ expr <- substitute(expr )
43+ }
44+ # Install the (user-supplied) expression as a function
4245 # This way, if the user-supplied expression contains a return()
4346 # statement, we can capture that return value and pass it along
4447 # to prepareWidget()
45- expr <- call(" evalq" , expr , env )
4648 # prepareWidget() makes it possible to pass different non-plotly
4749 # objects to renderPlotly() (e.g., ggplot2, promises). It also is used
4850 # to inform event_data about what events have been registered
49- expr <- as.call(list (call(" :::" , quote(" plotly" ), quote(" prepareWidget" )), expr ))
50- renderFunc <- shinyRenderWidget(expr , plotlyOutput , env , quoted = TRUE )
51+ shiny :: installExprFunction(expr , " func" , env , quoted )
52+ renderFunc <- shinyRenderWidget(
53+ plotly ::: prepareWidget(func()), plotlyOutput , env , quoted
54+ )
5155 # remove 'internal' plotly attributes that are known to cause false
5256 # positive test results in shinytest (snapshotPreprocessOutput was added
5357 # in shiny 1.0.3.9002, but we require >= 1.1)
0 commit comments