Add methods: reactlog, reactlogShow, and reactlogReset. Depricate showReactLog

Update links to help file to not use `showReactLog`, but `reactlogShow`
Use updated reactlog pkg function api of reactlog_*. This may fail right now, but rerun travis when the reactlog code is merged into master.
This commit is contained in:
Barret Schloerke
2019-01-30 12:20:22 -05:00
parent 8ae31eb998
commit bcac115c3d
8 changed files with 63 additions and 13 deletions

View File

@@ -86,7 +86,7 @@ Suggests:
markdown,
rmarkdown,
ggplot2,
reactlog (>= 0.0.0.9001),
reactlog (>= 0.0.0.9002),
magrittr
URL: http://shiny.rstudio.com
BugReports: https://github.com/rstudio/shiny/issues
@@ -165,3 +165,4 @@ Collate:
'timer.R'
'update-input.R'
RoxygenNote: 6.1.1
Encoding: UTF-8

View File

@@ -189,6 +189,9 @@ export(reactiveUI)
export(reactiveVal)
export(reactiveValues)
export(reactiveValuesToList)
export(reactlog)
export(reactlogReset)
export(reactlogShow)
export(registerInputHandler)
export(removeInputHandler)
export(removeModal)

View File

@@ -7,7 +7,7 @@ shiny 1.2.0.9001
### New features
* Revamped Shiny's [reactlog](https://github.com/rstudio/reactlog) viewer which debugs reactivity within a shiny application. This allows users to traverse the reactivity history of a shiny application, filter to the dependency tree of a selected reactive object, and search for matching reactive objects. See `?showReactLog` for more details and how to enable this feature. ([#2107](https://github.com/rstudio/shiny/pull/2107))
* Revamped Shiny's [reactlog](https://github.com/rstudio/reactlog) viewer which debugs reactivity within a shiny application. This allows users to traverse the reactivity history of a shiny application, filter to the dependency tree of a selected reactive object, and search for matching reactive objects. See `?reactlogShow` for more details and how to enable this feature. ([#2107](https://github.com/rstudio/shiny/pull/2107))
* Shiny now serves static files on a background thread. This means that things like JavaScript and CSS assets can be served without blocking or being blocked by the main R thread, and should result in significantly better performance for heavily loaded servers. ([#2280](https://github.com/rstudio/shiny/pull/2280))

View File

@@ -75,11 +75,11 @@ reactIdStr <- function(num) {
#'
#' As an alternative to pressing Ctrl/Command+F3--for example, if you
#' are using reactives outside of the context of a Shiny
#' application--you can run the \code{showReactLog} function, which will
#' application--you can run the \code{reactlogShow} function, which will
#' generate the reactive log visualization as a static HTML file and
#' launch it in your default browser. In this case, refreshing your
#' browser will not load new activity into the report; you will need to
#' call \code{showReactLog()} explicitly.
#' call \code{reactlogShow()} explicitly.
#'
#' For security and performance reasons, do not enable
#' \code{shiny.reactlog} in production environments. When the option is
@@ -88,16 +88,41 @@ reactIdStr <- function(num) {
#'
#' @param time A boolean that specifies whether or not to display the
#' time that each reactive.
#' @name reactlog
NULL
#' @describeIn reactlog Return a list of reactive information. Can be used in conjunction with
#' \code{reactlog::\link[reactlog]{reactlog_show}} to later display the reactlog graph.
#' @export
showReactLog <- function(time = TRUE) {
check_reactlog()
reactlog::show_reactlog(rLog$asList(), time = time)
reactlog <- function() {
rLog$asList()
}
#' @describeIn reactlog Display a full reactlog graph for all sessions.
#' @export
reactlogShow <- function(time = TRUE) {
check_reactlog()
reactlog::reactlog_show(reactlog(), time = time)
}
#' @describeIn reactlog This function is deprecated. You should use \code{\link{reactlogShow}}
#' @export
# legacy purposes
showReactLog <- function(...) {
shinyDeprecated(new = "`reactlogShow`", version = "1.2.0")
reactlogShow(...)
}
#' @describeIn reactlog Resets the entire reactlog stack. Useful for debugging and removing all prior reactive history.
#' @export
reactlogReset <- function() {
rLog$reset()
}
# called in "/reactlog" middleware
renderReactlog <- function(sessionToken = NULL, time = TRUE) {
check_reactlog()
reactlog::render_reactlog(
rLog$asList(),
reactlog::reactlog_render(
reactlog(),
session_token = sessionToken,
time = time
)

View File

@@ -140,7 +140,7 @@ ReactiveVal <- R6Class(
#'
#' @param value An optional initial value.
#' @param label An optional label, for debugging purposes (see
#' \code{\link{showReactLog}}). If missing, a label will be automatically
#' \code{\link{reactlogShow}}). If missing, a label will be automatically
#' created.
#'
#' @return A function. Call the function with no arguments to (reactively) read

View File

@@ -62,7 +62,7 @@ NULL
#' by setting e.g. \code{options(shiny.autoreload.interval = 2000)} (every
#' two seconds).}
#' \item{shiny.reactlog}{If \code{TRUE}, enable logging of reactive events,
#' which can be viewed later with the \code{\link{showReactLog}} function.
#' which can be viewed later with the \code{\link{reactlogShow}} function.
#' This incurs a substantial performance penalty and should not be used in
#' production.}
#' \item{shiny.usecairo}{This is used to disable graphical rendering by the

View File

@@ -1050,7 +1050,7 @@ safeError <- function(error) {
# #' @examples
# #' ## Note: the breaking of the reactive chain that happens in the app
# #' ## below (when input$txt = 'bad' and input$allowBad = 'FALSE') is
# #' ## easily visualized with `showReactLog()`
# #' ## easily visualized with `reactlogShow()`
# #'
# #' ## Only run examples in interactive R sessions
# #' if (interactive()) {

View File

@@ -1,10 +1,19 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/graph.R
\name{showReactLog}
\name{reactlog}
\alias{reactlog}
\alias{reactlogShow}
\alias{showReactLog}
\alias{reactlogReset}
\title{Reactive Log Visualizer}
\usage{
reactlog()
reactlogShow(time = TRUE)
showReactLog(time = TRUE)
reactlogReset()
}
\arguments{
\item{time}{A boolean that specifies whether or not to display the
@@ -43,3 +52,15 @@ For security and performance reasons, do not enable
enabled, it's possible for any user of your app to see at least some
of the source code of your reactive expressions and observers.
}
\section{Functions}{
\itemize{
\item \code{reactlog}: Return a list of reactive information. Can be used in conjunction with
\code{reactlog::\link[reactlog]{reactlog_show}} to later display the reactlog graph.
\item \code{reactlogShow}: Display a full reactlog graph for all sessions.
\item \code{showReactLog}: Display a full reactlog graph for all sessions. (Same \code{reactlogShow}. Legacy name.)
\item \code{reactlogReset}: Resets the entire reactlog stack. Useful for debugging and removing all prior reactive history.
}}