mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-12 00:19:06 -05:00
Compare commits
4 Commits
feat/remov
...
build_docs
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1522af8cf | ||
|
|
abe4743a74 | ||
|
|
2af1fe8697 | ||
|
|
93ee877838 |
25
.github/workflows/build-docs-on-tag.yml
vendored
Normal file
25
.github/workflows/build-docs-on-tag.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
name: Update website docs given new release tag
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- build_docs
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
trigger-build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Send repository dispatch event
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
github-token: ${{ secrets.SHINY_DEV_CENTER_GITHUB_TOKEN }}
|
||||
script: |
|
||||
await github.rest.repos.createDispatchEvent({
|
||||
owner: 'rstudio',
|
||||
repo: 'shiny-dev-center',
|
||||
event_type: 'build-r-reference',
|
||||
client_payload: {}
|
||||
});
|
||||
@@ -369,29 +369,6 @@ MockShinySession <- R6Class(
|
||||
})
|
||||
private$flush()
|
||||
},
|
||||
|
||||
#' @description Removes inputs from the `session$inputs` object and flushes
|
||||
#' the reactives.
|
||||
#' @param inputIds Character vector of input ids to remove.
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' session$setInputs(x=1, y=2)
|
||||
#' session$removeInputs("x")
|
||||
#' }
|
||||
removeInputs = function(inputIds) {
|
||||
is_clientdata <- grepl("^.clientdata_", inputIds)
|
||||
if (any(is_clientdata)) {
|
||||
abort(
|
||||
"Cannot remove clientData inputs: ",
|
||||
paste(inputIds[is_clientdata], collapse = ", ")
|
||||
)
|
||||
}
|
||||
|
||||
for (inputId in inputIds) {
|
||||
private$.input$remove(inputId)
|
||||
}
|
||||
private$flush()
|
||||
},
|
||||
|
||||
#' @description An internal method which shouldn't be used by others.
|
||||
#' Schedules `callback` for execution after some number of `millis`
|
||||
|
||||
@@ -398,6 +398,8 @@ ReactiveValues <- R6Class(
|
||||
# invalidate all deps of `key`
|
||||
|
||||
domain <- getDefaultReactiveDomain()
|
||||
hidden <- substr(key, 1, 1) == "."
|
||||
|
||||
key_exists <- .values$containsKey(key)
|
||||
|
||||
if (key_exists && !isTRUE(force) && .dedupe && identical(.values$get(key), value)) {
|
||||
@@ -418,15 +420,26 @@ ReactiveValues <- R6Class(
|
||||
.dependents$get(key)$invalidate()
|
||||
}
|
||||
|
||||
# invalidate names() or toList() if needed
|
||||
if (!key_exists) {
|
||||
private$invalidateNames(domain)
|
||||
# only invalidate if there are deps
|
||||
if (!key_exists && isTRUE(.hasRetrieved$names)) {
|
||||
rLog$valueChangeNames(.reactId, .values$keys(), domain)
|
||||
.namesDeps$invalidate()
|
||||
}
|
||||
|
||||
private$invalidateAsListAny(
|
||||
all.names = substr(key, 1, 1) == ".",
|
||||
domain = domain
|
||||
)
|
||||
if (hidden) {
|
||||
if (isTRUE(.hasRetrieved$asListAll)) {
|
||||
rLog$valueChangeAsListAll(.reactId, .values$values(), domain)
|
||||
.allValuesDeps$invalidate()
|
||||
}
|
||||
} else {
|
||||
if (isTRUE(.hasRetrieved$asList)) {
|
||||
react_vals <- .values$values()
|
||||
react_vals <- react_vals[!grepl("^\\.", base::names(react_vals))]
|
||||
# leave as is. both object would be registered to the listening object
|
||||
rLog$valueChangeAsList(.reactId, react_vals, domain)
|
||||
.valuesDeps$invalidate()
|
||||
}
|
||||
}
|
||||
|
||||
invisible()
|
||||
},
|
||||
@@ -438,21 +451,6 @@ ReactiveValues <- R6Class(
|
||||
})
|
||||
},
|
||||
|
||||
remove = function(key) {
|
||||
stopifnot(rlang::is_string(key))
|
||||
|
||||
if (!self$.values$containsKey(key)) {
|
||||
return(invisible())
|
||||
}
|
||||
|
||||
value <- self$.values$get(key)
|
||||
self$.values$remove(key)
|
||||
self$.nameOrder <- setdiff(self$.nameOrder, key)
|
||||
private$invalidateNames()
|
||||
private$invalidateAsListAny(all.names = substr(key, 1, 1) == ".")
|
||||
invisible(value)
|
||||
},
|
||||
|
||||
names = function() {
|
||||
if (!isTRUE(.hasRetrieved$names)) {
|
||||
domain <- getDefaultReactiveDomain()
|
||||
@@ -531,47 +529,7 @@ ReactiveValues <- R6Class(
|
||||
|
||||
return(listValue)
|
||||
}
|
||||
),
|
||||
private = list(
|
||||
invalidateNames = function(domain = getDefaultReactiveDomain()) {
|
||||
if (!isTRUE(self$.hasRetrieved$names)) {
|
||||
return(invisible())
|
||||
}
|
||||
rLog$valueChangeNames(self$.reactId, self$.values$keys(), domain)
|
||||
self$.namesDeps$invalidate()
|
||||
},
|
||||
|
||||
invalidateAsListAny = function(
|
||||
all.names,
|
||||
domain = getDefaultReactiveDomain()
|
||||
) {
|
||||
if (isTRUE(all.names)) {
|
||||
private$invalidateAsListAll(domain)
|
||||
} else {
|
||||
private$invalidateAsList(domain)
|
||||
}
|
||||
},
|
||||
|
||||
invalidateAsListAll = function(domain = getDefaultReactiveDomain()) {
|
||||
if (!isTRUE(self$.hasRetrieved$asListAll)) {
|
||||
return(invisible())
|
||||
}
|
||||
|
||||
rLog$valueChangeAsListAll(self$.reactId, self$.values$values(), domain)
|
||||
self$.allValuesDeps$invalidate()
|
||||
},
|
||||
|
||||
invalidateAsList = function(domain = getDefaultReactiveDomain()) {
|
||||
if (!isTRUE(self$.hasRetrieved$asList)) {
|
||||
return(invisible())
|
||||
}
|
||||
|
||||
react_vals <- self$.values$values()
|
||||
react_vals <- react_vals[!grepl("^\\.", base::names(react_vals))]
|
||||
# leave as is. both object would be registered to the listening object
|
||||
rLog$valueChangeAsList(self$.reactId, react_vals, domain)
|
||||
self$.valuesDeps$invalidate()
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
@@ -641,15 +599,14 @@ checkName <- function(x) {
|
||||
# @param ns A namespace function (either `identity` or `NS(namespace)`)
|
||||
.createReactiveValues <- function(values = NULL, readonly = FALSE,
|
||||
ns = identity) {
|
||||
|
||||
|
||||
structure(
|
||||
list(
|
||||
impl = values,
|
||||
readonly = readonly,
|
||||
ns = ns
|
||||
),
|
||||
class='reactivevalues',
|
||||
remove = function(key) values$remove(key)
|
||||
class='reactivevalues'
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
13
R/shiny.R
13
R/shiny.R
@@ -2159,19 +2159,6 @@ ShinySession <- R6Class(
|
||||
self$cycleStartAction(doManageInputs)
|
||||
}
|
||||
},
|
||||
removeInputs = function(inputIds) {
|
||||
is_clientdata <- grepl("^.clientdata_", inputIds)
|
||||
if (any(is_clientdata)) {
|
||||
abort(
|
||||
"Cannot remove clientData inputs: ",
|
||||
paste(inputIds[is_clientdata], collapse = ", ")
|
||||
)
|
||||
}
|
||||
|
||||
for (inputId in inputIds) {
|
||||
private$.input$remove(inputId)
|
||||
}
|
||||
},
|
||||
outputOptions = function(name, ...) {
|
||||
# If no name supplied, return the list of options for all outputs
|
||||
if (is.null(name))
|
||||
|
||||
@@ -28,15 +28,6 @@ of \code{\link[=testServer]{testServer()}}.
|
||||
\dontrun{
|
||||
session$setInputs(x=1, y=2)
|
||||
}
|
||||
|
||||
## ------------------------------------------------
|
||||
## Method `MockShinySession$removeInputs`
|
||||
## ------------------------------------------------
|
||||
|
||||
\dontrun{
|
||||
session$setInputs(x=1, y=2)
|
||||
session$removeInputs("x")
|
||||
}
|
||||
}
|
||||
\section{Public fields}{
|
||||
\if{html}{\out{<div class="r6-fields">}}
|
||||
@@ -104,7 +95,6 @@ user. Always \code{NULL} for a \code{MockShinySesion}.}
|
||||
\item \href{#method-MockShinySession-cycleStartAction}{\code{MockShinySession$cycleStartAction()}}
|
||||
\item \href{#method-MockShinySession-fileUrl}{\code{MockShinySession$fileUrl()}}
|
||||
\item \href{#method-MockShinySession-setInputs}{\code{MockShinySession$setInputs()}}
|
||||
\item \href{#method-MockShinySession-removeInputs}{\code{MockShinySession$removeInputs()}}
|
||||
\item \href{#method-MockShinySession-.scheduleTask}{\code{MockShinySession$.scheduleTask()}}
|
||||
\item \href{#method-MockShinySession-elapse}{\code{MockShinySession$elapse()}}
|
||||
\item \href{#method-MockShinySession-.now}{\code{MockShinySession$.now()}}
|
||||
@@ -289,35 +279,6 @@ session$setInputs(x=1, y=2)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
\if{html}{\out{<hr>}}
|
||||
\if{html}{\out{<a id="method-MockShinySession-removeInputs"></a>}}
|
||||
\if{latex}{\out{\hypertarget{method-MockShinySession-removeInputs}{}}}
|
||||
\subsection{Method \code{removeInputs()}}{
|
||||
Removes inputs from the \code{session$inputs} object and flushes
|
||||
the reactives.
|
||||
\subsection{Usage}{
|
||||
\if{html}{\out{<div class="r">}}\preformatted{MockShinySession$removeInputs(inputIds)}\if{html}{\out{</div>}}
|
||||
}
|
||||
|
||||
\subsection{Arguments}{
|
||||
\if{html}{\out{<div class="arguments">}}
|
||||
\describe{
|
||||
\item{\code{inputIds}}{Character vector of input ids to remove.}
|
||||
}
|
||||
\if{html}{\out{</div>}}
|
||||
}
|
||||
\subsection{Examples}{
|
||||
\if{html}{\out{<div class="r example copy">}}
|
||||
\preformatted{\dontrun{
|
||||
session$setInputs(x=1, y=2)
|
||||
session$removeInputs("x")
|
||||
}
|
||||
}
|
||||
\if{html}{\out{</div>}}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
\if{html}{\out{<hr>}}
|
||||
\if{html}{\out{<a id="method-MockShinySession-.scheduleTask"></a>}}
|
||||
|
||||
Reference in New Issue
Block a user