While capture is paused, the application applies changes as usual. But
rewind does not record them. Use this to stop capture for a period
that spans more than one reactive flush, such as while the user works
in a part of the application that undo must not cover.
Usage
rewind_pause(session = shiny::getDefaultReactiveDomain())
rewind_resume(session = shiny::getDefaultReactiveDomain())Not for a block of code
A pause and a resume in the same observer, or the same observeEvent(),
have no effect. rewind captures in its own observer, which runs after
the one that made the change. By then capture has resumed, so the change
is recorded as usual. A change made with update*Input() also comes
back from the browser later.
For code that changes the application and must not make a step, such as
code that restores a saved view, use rewind_unrecorded().
Examples
if (interactive()) {
library(shiny)
server <- function(input, output, session) {
rewind_enable()
# Stop capture while an "expert mode" switch is on.
observeEvent(input$expert_mode, {
if (input$expert_mode) rewind_pause() else rewind_resume()
})
}
}
