Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit af1c770

Browse filesBrowse files
committed
Use shiny::installExprFunction to register debug hooks
1 parent dd474e2 commit af1c770
Copy full SHA for af1c770

File tree

Expand file treeCollapse file tree

1 file changed

+9
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-5
lines changed

‎R/shiny.R

Copy file name to clipboardExpand all lines: R/shiny.R
+9-5Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,21 @@ plotlyOutput <- function(outputId, width = "100%", height = "400px",
3737
#' @rdname plotly-shiny
3838
#' @export
3939
renderPlotly <- 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

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.