rewind_enable(exclude = ) leaves inputs out, but only the code that
calls rewind_enable() can set it. This function can be called from
anywhere in the server, a module included, at any time. It works like
shiny::setBookmarkExclude(): inside a module, give the names that the
module uses, and rewind adds the namespace.
Usage
rewind_exclude(
names = character(0),
session = shiny::getDefaultReactiveDomain()
)Details
Two things differ from setBookmarkExclude(). A second call adds to the
list; it does not replace it, so a module cannot undo an exclusion made
elsewhere. And a value already in the history for these inputs is
removed, together with any step that changed only them.
A call before rewind_enable() in the same session is kept, and applied
when rewind_enable() runs.
Examples
if (interactive()) {
library(shiny)
search_ui <- function(id) textInput(NS(id, "query"), "Search")
search_server <- function(id) {
moduleServer(id, function(input, output, session) {
# A search box that the user does not expect undo to move.
rewind_exclude("query")
})
}
ui <- fluidPage(
rewind_buttons(),
selectInput("region", "Region", c("North", "South")),
search_ui("search")
)
server <- function(input, output, session) {
rewind_enable()
search_server("search")
}
shinyApp(ui, server)
}
