mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-10 23:48:01 -05:00
Allow setting the state of RestoreContext (#3053)
* Allow setting the state of RestoreContext This setter only sets public fields, but it's still necessary because the RestoreInputSet R6 class is not exported. (I needed this functionality for shinytableau config dialogs to do a bookmark-like restore, but not at all based on querystring) * Use list instead of values to prevent accidental mutation See discussion here: https://github.com/rstudio/shiny/pull/3053#discussion_r488948453 * Rebuild JS for new version number
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
Package: shiny
|
||||
Type: Package
|
||||
Title: Web Application Framework for R
|
||||
Version: 1.5.0.9001
|
||||
Version: 1.5.0.9002
|
||||
Authors@R: c(
|
||||
person("Winston", "Chang", role = c("aut", "cre"), email = "winston@rstudio.com"),
|
||||
person("Joe", "Cheng", role = "aut", email = "joe@rstudio.com"),
|
||||
|
||||
@@ -217,6 +217,22 @@ RestoreContext <- R6Class("RestoreContext",
|
||||
self$dir <- NULL
|
||||
},
|
||||
|
||||
# Completely replace the state
|
||||
set = function(active = FALSE, initErrorMessage = NULL, input = list(), values = list(), dir = NULL) {
|
||||
# Validate all inputs
|
||||
stopifnot(is.logical(active))
|
||||
stopifnot(is.null(initErrorMessage) || is.character(initErrorMessage))
|
||||
stopifnot(is.list(input))
|
||||
stopifnot(is.list(values))
|
||||
stopifnot(is.null(dir) || is.character(dir))
|
||||
|
||||
self$active <- active
|
||||
self$initErrorMessage <- initErrorMessage
|
||||
self$input <- RestoreInputSet$new(input)
|
||||
self$values <- list2env2(values, parent = emptyenv())
|
||||
self$dir <- dir
|
||||
},
|
||||
|
||||
# This should be called before a restore context is popped off the stack.
|
||||
flushPending = function() {
|
||||
self$input$flushPending()
|
||||
@@ -453,7 +469,7 @@ hasCurrentRestoreContext <- function() {
|
||||
domain <- getDefaultReactiveDomain()
|
||||
if (!is.null(domain) && !is.null(domain$restoreContext))
|
||||
return(TRUE)
|
||||
|
||||
|
||||
return(FALSE)
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
||||
(function () {
|
||||
var $ = jQuery;
|
||||
var exports = window.Shiny = window.Shiny || {};
|
||||
exports.version = "1.5.0.9001"; // Version number inserted by Grunt
|
||||
exports.version = "1.5.0.9002"; // Version number inserted by Grunt
|
||||
|
||||
var origPushState = window.history.pushState;
|
||||
|
||||
|
||||
4
inst/www/shared/shiny.min.js
vendored
4
inst/www/shared/shiny.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user