From b4252746415c4ee093bfb75c62d9c7e72bc5a7a9 Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Tue, 10 Nov 2020 13:49:51 -0600 Subject: [PATCH 1/7] Remove deprecated reactive* functions --- R/shinywrappers.R | 61 ----------------------------------------------- 1 file changed, 61 deletions(-) diff --git a/R/shinywrappers.R b/R/shinywrappers.R index b92dc44601..c1b4a03c41 100644 --- a/R/shinywrappers.R +++ b/R/shinywrappers.R @@ -873,64 +873,3 @@ checkDT9 <- function(options) { names(options)[i] <- nms10 options } - -# Deprecated functions ------------------------------------------------------ - -#' Deprecated reactive functions -#' @name deprecatedReactives -#' @keywords internal -NULL - -#' Plot output (deprecated) -#' -#' `reactivePlot` has been replaced by [renderPlot()]. -#' @param func A function. -#' @param width Width. -#' @param height Height. -#' @param ... Other arguments to pass on. -#' @rdname deprecatedReactives -#' @export -reactivePlot <- function(func, width='auto', height='auto', ...) { - shinyDeprecated(new="renderPlot") - renderPlot({ func() }, width=width, height=height, ...) -} - -#' Table output (deprecated) -#' -#' `reactiveTable` has been replaced by [renderTable()]. -#' @rdname deprecatedReactives -#' @export -reactiveTable <- function(func, ...) { - shinyDeprecated(new="renderTable") - renderTable({ func() }) -} - -#' Print output (deprecated) -#' -#' `reactivePrint` has been replaced by [renderPrint()]. -#' @rdname deprecatedReactives -#' @export -reactivePrint <- function(func) { - shinyDeprecated(new="renderPrint") - renderPrint({ func() }) -} - -#' UI output (deprecated) -#' -#' `reactiveUI` has been replaced by [renderUI()]. -#' @rdname deprecatedReactives -#' @export -reactiveUI <- function(func) { - shinyDeprecated(new="renderUI") - renderUI({ func() }) -} - -#' Text output (deprecated) -#' -#' `reactiveText` has been replaced by [renderText()]. -#' @rdname deprecatedReactives -#' @export -reactiveText <- function(func) { - shinyDeprecated(new="renderText") - renderText({ func() }) -} From 913ea64dad3d93cc34158a4c32c171dd4e7a28d6 Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Tue, 10 Nov 2020 13:55:36 -0600 Subject: [PATCH 2/7] Remove deprecated code --- NAMESPACE | 6 ----- R/bootstrap.R | 27 +++---------------- R/graph.R | 7 ----- R/input-slider.R | 14 +++------- R/shiny.R | 10 ------- man/bootstrapPage.Rd | 5 +--- man/deprecatedReactives.Rd | 42 ------------------------------ man/navbarPage.Rd | 3 --- man/reactlog.Rd | 5 ---- man/sliderInput.Rd | 7 ++--- man/tabsetPanel.Rd | 6 +---- tools/documentation/checkPkgdown.R | 2 +- 12 files changed, 11 insertions(+), 123 deletions(-) delete mode 100644 man/deprecatedReactives.Rd diff --git a/NAMESPACE b/NAMESPACE index 187a40ad15..1b6ceaa258 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -203,13 +203,8 @@ export(radioButtons) export(reactive) export(reactiveConsole) export(reactiveFileReader) -export(reactivePlot) export(reactivePoll) -export(reactivePrint) -export(reactiveTable) -export(reactiveText) export(reactiveTimer) -export(reactiveUI) export(reactiveVal) export(reactiveValues) export(reactiveValuesToList) @@ -260,7 +255,6 @@ export(shinyUI) export(showBookmarkUrlModal) export(showModal) export(showNotification) -export(showReactLog) export(showTab) export(sidebarLayout) export(sidebarPanel) diff --git a/R/bootstrap.R b/R/bootstrap.R index 5143c8aff1..7c5d26189b 100644 --- a/R/bootstrap.R +++ b/R/bootstrap.R @@ -14,8 +14,6 @@ NULL #' #' @param ... The contents of the document body. #' @param title The browser window title (defaults to the host URL of the page) -#' @param responsive This option is deprecated; it is no longer optional with -#' Bootstrap 3. #' @param theme One of the following: #' * `NULL` (the default), which implies a "stock" build of Bootstrap 3. #' * A [bslib::bs_theme()] object. This can be used to replace a stock @@ -33,11 +31,7 @@ NULL #' #' @seealso [fluidPage()], [fixedPage()] #' @export -bootstrapPage <- function(..., title = NULL, responsive = NULL, theme = NULL, lang = NULL) { - - if (!is.null(responsive)) { - shinyDeprecated("The 'responsive' argument is no longer used with Bootstrap 3.") - } +bootstrapPage <- function(..., title = NULL, theme = NULL, lang = NULL) { ui <- tagList( bootstrapLib(theme), @@ -360,7 +354,6 @@ collapseSizes <- function(padding) { #' @param collapsible `TRUE` to automatically collapse the navigation #' elements into a menu when the width of the browser is less than 940 pixels #' (useful for viewing on smaller touchscreen device) -#' @param collapsable Deprecated; use `collapsible` instead. #' @param fluid `TRUE` to use a fluid layout. `FALSE` to use a fixed #' layout. #' @param responsive This option is deprecated; it is no longer optional with @@ -411,18 +404,12 @@ navbarPage <- function(title, footer = NULL, inverse = FALSE, collapsible = FALSE, - collapsable, fluid = TRUE, responsive = NULL, theme = NULL, windowTitle = title, lang = NULL) { - if (!missing(collapsable)) { - shinyDeprecated("`collapsable` is deprecated; use `collapsible` instead.") - collapsible <- collapsable - } - # alias title so we can avoid conflicts w/ title in withTags pageTitle <- title @@ -682,8 +669,6 @@ tabPanelBody <- function(value, ..., icon = NULL) { #' conjunction with [tabPanelBody()] and [updateTabsetPanel()] to control the #' active tab via other input controls. (See example below)} #' } -#' @param position This argument is deprecated; it has been discontinued in -#' Bootstrap 3. #' @return A tabset that can be passed to [mainPanel()] #' #' @seealso [tabPanel()], [updateTabsetPanel()], @@ -732,14 +717,8 @@ tabPanelBody <- function(value, ..., icon = NULL) { tabsetPanel <- function(..., id = NULL, selected = NULL, - type = c("tabs", "pills", "hidden"), - position = NULL) { - if (!is.null(position)) { - shinyDeprecated(msg = paste("tabsetPanel: argument 'position' is deprecated;", - "it has been discontinued in Bootstrap 3."), - version = "0.10.2.2") - } - + type = c("tabs", "pills", "hidden")) +{ if (!is.null(id)) selected <- restoreInput(id = id, default = selected) diff --git a/R/graph.R b/R/graph.R index 17250a3760..de1c692855 100644 --- a/R/graph.R +++ b/R/graph.R @@ -94,13 +94,6 @@ reactlogShow <- function(time = TRUE) { check_reactlog() reactlog::reactlog_show(reactlog(), time = time) } -#' @describeIn reactlog This function is deprecated. You should use [reactlogShow()] -#' @export -# legacy purposes -showReactLog <- function(time = TRUE) { - shinyDeprecated(new = "`reactlogShow`", version = "1.2.0") - reactlogShow(time = time) -} #' @describeIn reactlog Resets the entire reactlog stack. Useful for debugging and removing all prior reactive history. #' @export reactlogReset <- function() { diff --git a/R/input-slider.R b/R/input-slider.R index 9f20938886..6e2e9aa7ce 100644 --- a/R/input-slider.R +++ b/R/input-slider.R @@ -18,8 +18,7 @@ #' number of digits (for example, 1 will round to the nearest 10, and -2 will #' round to the nearest .01). Any rounding will be applied after snapping to #' the nearest step. -#' @param format Deprecated. -#' @param locale Deprecated. +#' @param ... Reserved for future use. #' @param ticks `FALSE` to hide tick marks, `TRUE` to show them #' according to some simple heuristics. #' @param animate `TRUE` to show simple animation controls with default @@ -76,18 +75,11 @@ #' #' @export sliderInput <- function(inputId, label, min, max, value, step = NULL, - round = FALSE, format = NULL, locale = NULL, + round = FALSE, ..., ticks = TRUE, animate = FALSE, width = NULL, sep = ",", pre = NULL, post = NULL, timeFormat = NULL, timezone = NULL, dragRange = TRUE) { - if (!missing(format)) { - shinyDeprecated(msg = "The `format` argument to sliderInput is deprecated. Use `sep`, `pre`, and `post` instead.", - version = "0.10.2.2") - } - if (!missing(locale)) { - shinyDeprecated(msg = "The `locale` argument to sliderInput is deprecated. Use `sep`, `pre`, and `post` instead.", - version = "0.10.2.2") - } + check_dots_empty() dataType <- getSliderType(min, max, value) diff --git a/R/shiny.R b/R/shiny.R index cd4051c5a7..02cd0fa873 100644 --- a/R/shiny.R +++ b/R/shiny.R @@ -2071,16 +2071,6 @@ ShinySession <- R6Class( }) } } - ), - active = list( - session = function() { - shinyDeprecated( - msg = paste("Attempted to access deprecated shinysession$session object.", - "Please just access the shinysession object directly."), - version = "0.11.1" - ) - self - } ) ) diff --git a/man/bootstrapPage.Rd b/man/bootstrapPage.Rd index 81ef47ceb5..ca14f2874c 100644 --- a/man/bootstrapPage.Rd +++ b/man/bootstrapPage.Rd @@ -5,7 +5,7 @@ \alias{basicPage} \title{Create a Bootstrap page} \usage{ -bootstrapPage(..., title = NULL, responsive = NULL, theme = NULL, lang = NULL) +bootstrapPage(..., title = NULL, theme = NULL, lang = NULL) basicPage(...) } @@ -14,9 +14,6 @@ basicPage(...) \item{title}{The browser window title (defaults to the host URL of the page)} -\item{responsive}{This option is deprecated; it is no longer optional with -Bootstrap 3.} - \item{theme}{One of the following: \itemize{ \item \code{NULL} (the default), which implies a "stock" build of Bootstrap 3. diff --git a/man/deprecatedReactives.Rd b/man/deprecatedReactives.Rd deleted file mode 100644 index 80124788b8..0000000000 --- a/man/deprecatedReactives.Rd +++ /dev/null @@ -1,42 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/shinywrappers.R -\name{deprecatedReactives} -\alias{deprecatedReactives} -\alias{reactivePlot} -\alias{reactiveTable} -\alias{reactivePrint} -\alias{reactiveUI} -\alias{reactiveText} -\title{Deprecated reactive functions} -\usage{ -reactivePlot(func, width = "auto", height = "auto", ...) - -reactiveTable(func, ...) - -reactivePrint(func) - -reactiveUI(func) - -reactiveText(func) -} -\arguments{ -\item{func}{A function.} - -\item{width}{Width.} - -\item{height}{Height.} - -\item{...}{Other arguments to pass on.} -} -\description{ -\code{reactivePlot} has been replaced by \code{\link[=renderPlot]{renderPlot()}}. - -\code{reactiveTable} has been replaced by \code{\link[=renderTable]{renderTable()}}. - -\code{reactivePrint} has been replaced by \code{\link[=renderPrint]{renderPrint()}}. - -\code{reactiveUI} has been replaced by \code{\link[=renderUI]{renderUI()}}. - -\code{reactiveText} has been replaced by \code{\link[=renderText]{renderText()}}. -} -\keyword{internal} diff --git a/man/navbarPage.Rd b/man/navbarPage.Rd index 5a8f7b9fd8..fd107b2c2a 100644 --- a/man/navbarPage.Rd +++ b/man/navbarPage.Rd @@ -15,7 +15,6 @@ navbarPage( footer = NULL, inverse = FALSE, collapsible = FALSE, - collapsable, fluid = TRUE, responsive = NULL, theme = NULL, @@ -63,8 +62,6 @@ navigation bar} elements into a menu when the width of the browser is less than 940 pixels (useful for viewing on smaller touchscreen device)} -\item{collapsable}{Deprecated; use \code{collapsible} instead.} - \item{fluid}{\code{TRUE} to use a fluid layout. \code{FALSE} to use a fixed layout.} diff --git a/man/reactlog.Rd b/man/reactlog.Rd index 3f176e2fc3..68db12107b 100644 --- a/man/reactlog.Rd +++ b/man/reactlog.Rd @@ -3,7 +3,6 @@ \name{reactlog} \alias{reactlog} \alias{reactlogShow} -\alias{showReactLog} \alias{reactlogReset} \title{Reactive Log Visualizer} \usage{ @@ -11,8 +10,6 @@ reactlog() reactlogShow(time = TRUE) -showReactLog(time = TRUE) - reactlogReset() } \arguments{ @@ -59,8 +56,6 @@ of the source code of your reactive expressions and observers. \item \code{reactlogShow}: Display a full reactlog graph for all sessions. -\item \code{showReactLog}: This function is deprecated. You should use \code{\link[=reactlogShow]{reactlogShow()}} - \item \code{reactlogReset}: Resets the entire reactlog stack. Useful for debugging and removing all prior reactive history. }} diff --git a/man/sliderInput.Rd b/man/sliderInput.Rd index 7fde5e47a5..e80c0a9087 100644 --- a/man/sliderInput.Rd +++ b/man/sliderInput.Rd @@ -13,8 +13,7 @@ sliderInput( value, step = NULL, round = FALSE, - format = NULL, - locale = NULL, + ..., ticks = TRUE, animate = FALSE, width = NULL, @@ -58,9 +57,7 @@ number of digits (for example, 1 will round to the nearest 10, and -2 will round to the nearest .01). Any rounding will be applied after snapping to the nearest step.} -\item{format}{Deprecated.} - -\item{locale}{Deprecated.} +\item{...}{Reserved for future use.} \item{ticks}{\code{FALSE} to hide tick marks, \code{TRUE} to show them according to some simple heuristics.} diff --git a/man/tabsetPanel.Rd b/man/tabsetPanel.Rd index 2eec44fdea..f37e1f4f2f 100644 --- a/man/tabsetPanel.Rd +++ b/man/tabsetPanel.Rd @@ -8,8 +8,7 @@ tabsetPanel( ..., id = NULL, selected = NULL, - type = c("tabs", "pills", "hidden"), - position = NULL + type = c("tabs", "pills", "hidden") ) } \arguments{ @@ -31,9 +30,6 @@ tab will be selected.} conjunction with \code{\link[=tabPanelBody]{tabPanelBody()}} and \code{\link[=updateTabsetPanel]{updateTabsetPanel()}} to control the active tab via other input controls. (See example below)} }} - -\item{position}{This argument is deprecated; it has been discontinued in -Bootstrap 3.} } \value{ A tabset that can be passed to \code{\link[=mainPanel]{mainPanel()}} diff --git a/tools/documentation/checkPkgdown.R b/tools/documentation/checkPkgdown.R index c54d93d111..8da9394c09 100644 --- a/tools/documentation/checkPkgdown.R +++ b/tools/documentation/checkPkgdown.R @@ -31,7 +31,7 @@ local({ ) known_unindexed <- c("shiny-package", "stacktrace", "knitr_methods", "pageWithSidebar", "headerPanel", "shiny.appobj", - "deprecatedReactives", "reexports", "makeReactiveBinding", + "reexports", "makeReactiveBinding", "reactiveConsole", "registerThemeDependency", "memoryCache", "diskCache") From cb9d9533025c4bea8cfcf2e838c10f010f62b39e Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Tue, 10 Nov 2020 14:03:32 -0600 Subject: [PATCH 3/7] Update NEWS --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index 02de0ec11f..4d1cc52dda 100644 --- a/NEWS.md +++ b/NEWS.md @@ -58,6 +58,8 @@ shiny 1.5.0.9000 * Shiny now uses `cache_mem` from the cachem package, instead of `memoryCache` and `diskCache`. (#3118) +* Some long-deprecated functions and function parameters were removed. (#3137) + ### Bug fixes * Fixed #2859: `renderPlot()` wasn't correctly setting `showtext::showtext_opts()`'s `dpi` setting with the correct resolution on high resolution displays; which means, if the font was rendered by showtext, font sizes would look smaller than they should on such displays. (#2941) From a1e79e856f078edf980153f63628fd5cd650075f Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Tue, 10 Nov 2020 16:00:11 -0600 Subject: [PATCH 4/7] Remove extractStackTrace and formatStackTrace --- NAMESPACE | 2 - R/conditions.R | 156 +++++++--------------------------------------- man/stacktrace.Rd | 28 --------- 3 files changed, 23 insertions(+), 163 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 1b6ceaa258..47eaae46db 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -101,7 +101,6 @@ export(enableBookmarking) export(eventReactive) export(exportTestValues) export(exprToFunction) -export(extractStackTrace) export(fileInput) export(fillCol) export(fillPage) @@ -112,7 +111,6 @@ export(fixedRow) export(flowLayout) export(fluidPage) export(fluidRow) -export(formatStackTrace) export(freezeReactiveVal) export(freezeReactiveValue) export(getCurrentOutputInfo) diff --git a/R/conditions.R b/R/conditions.R index 70e64bc699..6bc1d8b473 100644 --- a/R/conditions.R +++ b/R/conditions.R @@ -133,7 +133,7 @@ captureStackTraces <- function(expr) { createStackTracePromiseDomain <- function() { # These are actually stateless, we wouldn't have to create a new one each time # if we didn't want to. They're pretty cheap though. - + d <- promises::new_promise_domain( wrapOnFulfilled = function(onFulfilled) { force(onFulfilled) @@ -266,10 +266,10 @@ withLogErrors <- function(expr, printError <- function(cond, full = getOption("shiny.fullstacktrace", FALSE), offset = getOption("shiny.stacktraceoffset", TRUE)) { - - warning(call. = FALSE, immediate. = TRUE, sprintf("Error in %s: %s", + + warning(call. = FALSE, immediate. = TRUE, sprintf("Error in %s: %s", getCallNames(list(conditionCall(cond))), conditionMessage(cond))) - + printStackTrace(cond, full = full, offset = offset) } @@ -282,16 +282,16 @@ printStackTrace <- function(cond, should_drop <- !full should_strip <- !full should_prune <- !full - + stackTraceCalls <- c( attr(cond, "deep.stack.trace", exact = TRUE), list(attr(cond, "stack.trace", exact = TRUE)) ) - + stackTraceParents <- lapply(stackTraceCalls, attr, which = "parents", exact = TRUE) stackTraceCallNames <- lapply(stackTraceCalls, getCallNames) stackTraceCalls <- lapply(stackTraceCalls, offsetSrcrefs, offset = offset) - + # Use dropTrivialFrames logic to remove trailing bits (.handleSimpleError, h) if (should_drop) { # toKeep is a list of logical vectors, of which elements (stack frames) to keep @@ -301,7 +301,7 @@ printStackTrace <- function(cond, stackTraceCallNames <- mapply(stackTraceCallNames, FUN = `[`, toKeep, SIMPLIFY = FALSE) stackTraceParents <- mapply(stackTraceParents, FUN = `[`, toKeep, SIMPLIFY = FALSE) } - + delayedAssign("all_true", { # List of logical vectors that are all TRUE, the same shape as # stackTraceCallNames. Delay the evaluation so we don't create it unless @@ -310,7 +310,7 @@ printStackTrace <- function(cond, rep_len(TRUE, length(st)) }) }) - + # stripStackTraces and lapply(stackTraceParents, pruneStackTrace) return lists # of logical vectors. Use mapply(FUN = `&`) to boolean-and each pair of the # logical vectors. @@ -320,7 +320,7 @@ printStackTrace <- function(cond, FUN = `&`, SIMPLIFY = FALSE ) - + dfs <- mapply(seq_along(stackTraceCalls), rev(stackTraceCalls), rev(stackTraceCallNames), rev(toShow), FUN = function(i, calls, nms, index) { st <- data.frame( num = rev(which(index)), @@ -329,7 +329,7 @@ printStackTrace <- function(cond, category = rev(getCallCategories(calls[index])), stringsAsFactors = FALSE ) - + if (i != 1) { message("From earlier call:") } @@ -357,83 +357,8 @@ printStackTrace <- function(cond, st }, SIMPLIFY = FALSE) - - invisible() -} - -#' @details `extractStackTrace` takes a list of calls (e.g. as returned -#' from `conditionStackTrace(cond)`) and returns a data frame with one -#' row for each stack frame and the columns `num` (stack frame number), -#' `call` (a function name or similar), and `loc` (source file path -#' and line number, if available). It was deprecated after shiny 1.0.5 because -#' it doesn't support deep stack traces. -#' @rdname stacktrace -#' @export -extractStackTrace <- function(calls, - full = getOption("shiny.fullstacktrace", FALSE), - offset = getOption("shiny.stacktraceoffset", TRUE)) { - - shinyDeprecated(NULL, - "extractStackTrace is deprecated. Please contact the Shiny team if you were using this functionality.", - version = "1.0.5") - - srcrefs <- getSrcRefs(calls) - if (offset) { - # Offset calls vs. srcrefs by 1 to make them more intuitive. - # E.g. for "foo [bar.R:10]", line 10 of bar.R will be part of - # the definition of foo(). - srcrefs <- c(utils::tail(srcrefs, -1), list(NULL)) - } - calls <- setSrcRefs(calls, srcrefs) - - callnames <- getCallNames(calls) - - # Hide and show parts of the callstack based on ..stacktrace(on|off).. - if (full) { - toShow <- rep.int(TRUE, length(calls)) - } else { - # Remove stop(), .handleSimpleError(), and h() calls from the end of - # the calls--they don't add any helpful information. But only remove - # the last *contiguous* block of them, and then, only if they are the - # last thing in the calls list. - hideable <- callnames %in% c("stop", ".handleSimpleError", "h") - # What's the last that *didn't* match stop/.handleSimpleError/h? - lastGoodCall <- max(which(!hideable)) - toRemove <- length(calls) - lastGoodCall - # But don't remove more than 5 levels--that's an indication we might - # have gotten it wrong, I guess - if (toRemove > 0 && toRemove < 5) { - calls <- utils::head(calls, -toRemove) - callnames <- utils::head(callnames, -toRemove) - } - # This uses a ref-counting scheme. It might make sense to switch this - # to a toggling scheme, so the most recent ..stacktrace(on|off).. - # directive wins, regardless of what came before it. - # Also explicitly remove ..stacktraceon.. because it can appear with - # score > 0 but still should never be shown. - score <- rep.int(0, length(callnames)) - score[callnames == "..stacktraceoff.."] <- -1 - score[callnames == "..stacktraceon.."] <- 1 - toShow <- (1 + cumsum(score)) > 0 & !(callnames %in% c("..stacktraceon..", "..stacktraceoff..", "..stacktracefloor..")) - - # doTryCatch, tryCatchOne, and tryCatchList are not informative--they're - # just internals for tryCatch - toShow <- toShow & !(callnames %in% c("doTryCatch", "tryCatchOne", "tryCatchList")) - } - calls <- calls[toShow] - - calls <- rev(calls) # Show in traceback() order - index <- rev(which(toShow)) - width <- floor(log10(max(index))) + 1 - - data.frame( - num = index, - call = getCallNames(calls), - loc = getLocs(calls), - category = getCallCategories(calls), - stringsAsFactors = FALSE - ) + invisible() } stripStackTraces <- function(stackTraces, values = FALSE) { @@ -459,19 +384,19 @@ stripOneStackTrace <- function(stackTrace, truncateFloor, startingScore) { prefix <- rep_len(FALSE, indexOfFloor) } } - + if (length(stackTrace) == 0) { return(list(score = startingScore, character(0))) } - + score <- rep.int(0L, length(stackTrace)) score[stackTrace == "..stacktraceon.."] <- 1L score[stackTrace == "..stacktraceoff.."] <- -1L score <- startingScore + cumsum(score) - + toShow <- score > 0 & !(stackTrace %in% c("..stacktraceon..", "..stacktraceoff..", "..stacktracefloor..")) - - + + list(score = utils::tail(score, 1), trace = c(prefix, toShow)) } @@ -486,11 +411,11 @@ pruneStackTrace <- function(parents) { # sufficient; we also need to drop nodes that are the last child, but one of # their ancestors is not. is_dupe <- duplicated(parents, fromLast = TRUE) - + # The index of the most recently seen node that was actually kept instead of # dropped. current_node <- 0 - + # Loop over the parent indices. Anything that is not parented by current_node # (a.k.a. last-known-good node), or is a dupe, can be discarded. Anything that # is kept becomes the new current_node. @@ -502,7 +427,7 @@ pruneStackTrace <- function(parents) { FALSE } }, FUN.VALUE = logical(1)) - + include } @@ -515,7 +440,7 @@ dropTrivialFrames <- function(callnames) { # What's the last that *didn't* match stop/.handleSimpleError/h? lastGoodCall <- max(which(!hideable)) toRemove <- length(callnames) - lastGoodCall - + c( rep_len(TRUE, length(callnames) - toRemove), rep_len(FALSE, toRemove) @@ -530,46 +455,11 @@ offsetSrcrefs <- function(calls, offset = TRUE) { # E.g. for "foo [bar.R:10]", line 10 of bar.R will be part of # the definition of foo(). srcrefs <- c(utils::tail(srcrefs, -1), list(NULL)) - - calls <- setSrcRefs(calls, srcrefs) - } - - calls -} - -#' @details `formatStackTrace` is similar to `extractStackTrace`, but -#' it returns a preformatted character vector instead of a data frame. It was -#' deprecated after shiny 1.0.5 because it doesn't support deep stack traces. -#' @param indent A string to prefix every line of the stack trace. -#' @rdname stacktrace -#' @export -formatStackTrace <- function(calls, indent = " ", - full = getOption("shiny.fullstacktrace", FALSE), - offset = getOption("shiny.stacktraceoffset", TRUE)) { - shinyDeprecated(NULL, - "extractStackTrace is deprecated. Please contact the Shiny team if you were using this functionality.", - version = "1.0.5") - - st <- extractStackTrace(calls, full = full, offset = offset) - if (nrow(st) == 0) { - return(character(0)) + calls <- setSrcRefs(calls, srcrefs) } - width <- floor(log10(max(st$num))) + 1 - paste0( - indent, - formatC(st$num, width = width), - ": ", - mapply(paste0(st$call, st$loc), st$category, FUN = function(name, category) { - if (category == "pkg") - crayon::silver(name) - else if (category == "user") - crayon::blue$bold(name) - else - crayon::white(name) - }) - ) + calls } getSrcRefs <- function(calls) { diff --git a/man/stacktrace.Rd b/man/stacktrace.Rd index 8e5494b71c..51f88415f9 100644 --- a/man/stacktrace.Rd +++ b/man/stacktrace.Rd @@ -6,8 +6,6 @@ \alias{withLogErrors} \alias{printError} \alias{printStackTrace} -\alias{extractStackTrace} -\alias{formatStackTrace} \alias{conditionStackTrace} \alias{conditionStackTrace<-} \alias{..stacktraceon..} @@ -34,19 +32,6 @@ printStackTrace( offset = getOption("shiny.stacktraceoffset", TRUE) ) -extractStackTrace( - calls, - full = getOption("shiny.fullstacktrace", FALSE), - offset = getOption("shiny.stacktraceoffset", TRUE) -) - -formatStackTrace( - calls, - indent = " ", - full = getOption("shiny.fullstacktrace", FALSE), - offset = getOption("shiny.stacktraceoffset", TRUE) -) - conditionStackTrace(cond) conditionStackTrace(cond) <- value @@ -72,8 +57,6 @@ left alone (traditional R treatment where the srcref is of the callsite).} \item{cond}{A condition that may have previously been annotated by \code{captureStackTraces} (or \code{withLogErrors}).} -\item{indent}{A string to prefix every line of the stack trace.} - \item{value}{The stack trace value to assign to the condition.} } \value{ @@ -108,17 +91,6 @@ to \code{withLogErrors}. \code{warning(immediate.=TRUE)}. \code{printStackTrace} prints the stack trace only. -\code{extractStackTrace} takes a list of calls (e.g. as returned -from \code{conditionStackTrace(cond)}) and returns a data frame with one -row for each stack frame and the columns \code{num} (stack frame number), -\code{call} (a function name or similar), and \code{loc} (source file path -and line number, if available). It was deprecated after shiny 1.0.5 because -it doesn't support deep stack traces. - -\code{formatStackTrace} is similar to \code{extractStackTrace}, but -it returns a preformatted character vector instead of a data frame. It was -deprecated after shiny 1.0.5 because it doesn't support deep stack traces. - \code{conditionStackTrace} and \verb{conditionStackTrace<-} are accessor functions for getting/setting stack traces on conditions. From f08ec04896f86ba891bf049d3b5eae8b75445416 Mon Sep 17 00:00:00 2001 From: Carson Date: Thu, 6 May 2021 09:04:33 -0500 Subject: [PATCH 5/7] remove responsive from bootstrapPage() wrappers --- R/bootstrap-layout.R | 10 ++-------- R/bootstrap.R | 4 ---- man/fixedPage.Rd | 11 +---------- man/fluidPage.Rd | 11 +---------- man/navbarPage.Rd | 4 ---- 5 files changed, 4 insertions(+), 36 deletions(-) diff --git a/R/bootstrap-layout.R b/R/bootstrap-layout.R index 1c57daf84b..bf208899c0 100644 --- a/R/bootstrap-layout.R +++ b/R/bootstrap-layout.R @@ -11,8 +11,6 @@ #' @param ... Elements to include within the page #' @param title The browser window title (defaults to the host URL of the page). #' Can also be set as a side effect of the [titlePanel()] function. -#' @param responsive This option is deprecated; it is no longer optional with -#' Bootstrap 3. #' @inheritParams bootstrapPage #' #' @return A UI defintion that can be passed to the [shinyUI] function. @@ -85,10 +83,9 @@ #' } #' @rdname fluidPage #' @export -fluidPage <- function(..., title = NULL, responsive = deprecated(), theme = NULL, lang = NULL) { +fluidPage <- function(..., title = NULL, theme = NULL, lang = NULL) { bootstrapPage(div(class = "container-fluid", ...), title = title, - responsive = responsive, theme = theme, lang = lang) } @@ -112,8 +109,6 @@ fluidRow <- function(...) { #' #' @param ... Elements to include within the container #' @param title The browser window title (defaults to the host URL of the page) -#' @param responsive This option is deprecated; it is no longer optional with -#' Bootstrap 3. #' @inheritParams bootstrapPage #' #' @return A UI defintion that can be passed to the [shinyUI] function. @@ -153,10 +148,9 @@ fluidRow <- function(...) { #' #' @rdname fixedPage #' @export -fixedPage <- function(..., title = NULL, responsive = deprecated(), theme = NULL, lang = NULL) { +fixedPage <- function(..., title = NULL, theme = NULL, lang = NULL) { bootstrapPage(div(class = "container", ...), title = title, - responsive = responsive, theme = theme, lang = lang) } diff --git a/R/bootstrap.R b/R/bootstrap.R index c4f2e41bcc..6b9e43bd00 100644 --- a/R/bootstrap.R +++ b/R/bootstrap.R @@ -380,8 +380,6 @@ collapseSizes <- function(padding) { #' (useful for viewing on smaller touchscreen device) #' @param fluid `TRUE` to use a fluid layout. `FALSE` to use a fixed #' layout. -#' @param responsive This option is deprecated; it is no longer optional with -#' Bootstrap 3. #' @param windowTitle The title that should be displayed by the browser window. #' Useful if `title` is not a string. #' @inheritParams bootstrapPage @@ -426,7 +424,6 @@ navbarPage <- function(title, inverse = FALSE, collapsible = FALSE, fluid = TRUE, - responsive = deprecated(), theme = NULL, windowTitle = title, lang = NULL) { @@ -487,7 +484,6 @@ navbarPage <- function(title, # build the page bootstrapPage( title = windowTitle, - responsive = responsive, theme = theme, lang = lang, tags$nav(class=navbarClass, role="navigation", containerDiv), diff --git a/man/fixedPage.Rd b/man/fixedPage.Rd index 17861c41b6..b27dc65149 100644 --- a/man/fixedPage.Rd +++ b/man/fixedPage.Rd @@ -5,13 +5,7 @@ \alias{fixedRow} \title{Create a page with a fixed layout} \usage{ -fixedPage( - ..., - title = NULL, - responsive = deprecated(), - theme = NULL, - lang = NULL -) +fixedPage(..., title = NULL, theme = NULL, lang = NULL) fixedRow(...) } @@ -20,9 +14,6 @@ fixedRow(...) \item{title}{The browser window title (defaults to the host URL of the page)} -\item{responsive}{This option is deprecated; it is no longer optional with -Bootstrap 3.} - \item{theme}{One of the following: \itemize{ \item \code{NULL} (the default), which implies a "stock" build of Bootstrap 3. diff --git a/man/fluidPage.Rd b/man/fluidPage.Rd index 91dd04f508..51e8610fb0 100644 --- a/man/fluidPage.Rd +++ b/man/fluidPage.Rd @@ -5,13 +5,7 @@ \alias{fluidRow} \title{Create a page with fluid layout} \usage{ -fluidPage( - ..., - title = NULL, - responsive = deprecated(), - theme = NULL, - lang = NULL -) +fluidPage(..., title = NULL, theme = NULL, lang = NULL) fluidRow(...) } @@ -21,9 +15,6 @@ fluidRow(...) \item{title}{The browser window title (defaults to the host URL of the page). Can also be set as a side effect of the \code{\link[=titlePanel]{titlePanel()}} function.} -\item{responsive}{This option is deprecated; it is no longer optional with -Bootstrap 3.} - \item{theme}{One of the following: \itemize{ \item \code{NULL} (the default), which implies a "stock" build of Bootstrap 3. diff --git a/man/navbarPage.Rd b/man/navbarPage.Rd index 2d4c87ae82..7bd8dde63f 100644 --- a/man/navbarPage.Rd +++ b/man/navbarPage.Rd @@ -16,7 +16,6 @@ navbarPage( inverse = FALSE, collapsible = FALSE, fluid = TRUE, - responsive = deprecated(), theme = NULL, windowTitle = title, lang = NULL @@ -65,9 +64,6 @@ elements into a menu when the width of the browser is less than 940 pixels \item{fluid}{\code{TRUE} to use a fluid layout. \code{FALSE} to use a fixed layout.} -\item{responsive}{This option is deprecated; it is no longer optional with -Bootstrap 3.} - \item{theme}{One of the following: \itemize{ \item \code{NULL} (the default), which implies a "stock" build of Bootstrap 3. From 4c71669d57cba19febaac664f739a45f1bd01701 Mon Sep 17 00:00:00 2001 From: Carson Date: Thu, 6 May 2021 09:07:18 -0500 Subject: [PATCH 6/7] Move extractStackTrace() to tests so they pass --- tests/testthat/test-stacks.R | 71 ++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/tests/testthat/test-stacks.R b/tests/testthat/test-stacks.R index 6b0edff2bb..178cae270f 100644 --- a/tests/testthat/test-stacks.R +++ b/tests/testthat/test-stacks.R @@ -32,6 +32,77 @@ causeError <- function(full) { df } +#' @details `extractStackTrace` takes a list of calls (e.g. as returned +#' from `conditionStackTrace(cond)`) and returns a data frame with one +#' row for each stack frame and the columns `num` (stack frame number), +#' `call` (a function name or similar), and `loc` (source file path +#' and line number, if available). It was deprecated after shiny 1.0.5 because +#' it doesn't support deep stack traces. +#' @rdname stacktrace +#' @export +extractStackTrace <- function(calls, + full = get_devmode_option("shiny.fullstacktrace", FALSE), + offset = getOption("shiny.stacktraceoffset", TRUE)) { + + srcrefs <- getSrcRefs(calls) + if (offset) { + # Offset calls vs. srcrefs by 1 to make them more intuitive. + # E.g. for "foo [bar.R:10]", line 10 of bar.R will be part of + # the definition of foo(). + srcrefs <- c(utils::tail(srcrefs, -1), list(NULL)) + } + calls <- setSrcRefs(calls, srcrefs) + + callnames <- getCallNames(calls) + + # Hide and show parts of the callstack based on ..stacktrace(on|off).. + if (full) { + toShow <- rep.int(TRUE, length(calls)) + } else { + # Remove stop(), .handleSimpleError(), and h() calls from the end of + # the calls--they don't add any helpful information. But only remove + # the last *contiguous* block of them, and then, only if they are the + # last thing in the calls list. + hideable <- callnames %in% c("stop", ".handleSimpleError", "h") + # What's the last that *didn't* match stop/.handleSimpleError/h? + lastGoodCall <- max(which(!hideable)) + toRemove <- length(calls) - lastGoodCall + # But don't remove more than 5 levels--that's an indication we might + # have gotten it wrong, I guess + if (toRemove > 0 && toRemove < 5) { + calls <- utils::head(calls, -toRemove) + callnames <- utils::head(callnames, -toRemove) + } + + # This uses a ref-counting scheme. It might make sense to switch this + # to a toggling scheme, so the most recent ..stacktrace(on|off).. + # directive wins, regardless of what came before it. + # Also explicitly remove ..stacktraceon.. because it can appear with + # score > 0 but still should never be shown. + score <- rep.int(0, length(callnames)) + score[callnames == "..stacktraceoff.."] <- -1 + score[callnames == "..stacktraceon.."] <- 1 + toShow <- (1 + cumsum(score)) > 0 & !(callnames %in% c("..stacktraceon..", "..stacktraceoff..", "..stacktracefloor..")) + + # doTryCatch, tryCatchOne, and tryCatchList are not informative--they're + # just internals for tryCatch + toShow <- toShow & !(callnames %in% c("doTryCatch", "tryCatchOne", "tryCatchList")) + } + calls <- calls[toShow] + + calls <- rev(calls) # Show in traceback() order + index <- rev(which(toShow)) + width <- floor(log10(max(index))) + 1 + + data.frame( + num = index, + call = getCallNames(calls), + loc = getLocs(calls), + category = getCallCategories(calls), + stringsAsFactors = FALSE + ) +} + cleanLocs <- function(locs) { locs[!grepl("test-stacks\\.R", locs, perl = TRUE)] <- "" sub("^.*#", "", locs) From d1bfe1e0107b0dbd0ecae5690355e3fdf26c6f79 Mon Sep 17 00:00:00 2001 From: Carson Date: Thu, 6 May 2021 09:09:52 -0500 Subject: [PATCH 7/7] Don't force suggested pkgs in devel on GHA --- .github/workflows/R-CMD-check.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 592a6d2b20..b2c8cedc59 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -118,6 +118,7 @@ jobs: - name: Check env: _R_CHECK_CRAN_INCOMING_: false + _R_CHECK_FORCE_SUGGESTS_: ${{ matrix.config.r != 'devel' }} run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") shell: Rscript {0}