From eb55c256c7cc66d0460e58366afb9d5cd1561cbd Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Mon, 26 Aug 2019 10:52:27 -0400 Subject: [PATCH] only send requried information across wire to browser for showcase mode --- R/shiny.R | 10 ++++++++-- inst/www/shared/shiny-showcase.js | 3 +-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/R/shiny.R b/R/shiny.R index 57968e087..1a012d833 100644 --- a/R/shiny.R +++ b/R/shiny.R @@ -1629,8 +1629,14 @@ ShinySession <- R6Class( reactlog = function(logEntry) { # Use sendCustomMessage instead of sendMessage, because the handler in # shiny-showcase.js only has access to public API of the Shiny object. - if (private$showcase) - self$sendCustomMessage("reactlog", logEntry) + if (private$showcase) { + srcref <- logEntry$srcref + srcfile <- logEntry$srcfile + if (!is.null(srcref) && !is.null(srcfile)) { + # only send needed information, not all of reactlog info. + self$sendCustomMessage("showcase-src", list(srcref = srcref, srcfile = srcfile)) + } + } }, reload = function() { private$sendMessage(reload = TRUE) diff --git a/inst/www/shared/shiny-showcase.js b/inst/www/shared/shiny-showcase.js index 8af096674..0493debfe 100644 --- a/inst/www/shared/shiny-showcase.js +++ b/inst/www/shared/shiny-showcase.js @@ -117,7 +117,7 @@ // If this is the main Shiny window, wire up our custom message handler. if (window.Shiny) { - Shiny.addCustomMessageHandler('reactlog', function(message) { + Shiny.addCustomMessageHandler('showcase-src', function(message) { if (message.srcref && message.srcfile) { highlightSrcref(message.srcref, message.srcfile); } @@ -267,4 +267,3 @@ if (window.hljs) hljs.initHighlightingOnLoad(); })(); -