% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plugin-serdes.R
\name{preserve_board}
\alias{preserve_board}
\alias{preserve_board_server}
\alias{restore_board}
\alias{preserve_board_ui}
\alias{serialize_board}
\title{Serialization plugin module}
\usage{
preserve_board(server = preserve_board_server, ui = preserve_board_ui)

preserve_board_server(id, board, ...)

restore_board(x, new, result, ..., session = get_session())

preserve_board_ui(id, board)

serialize_board(x, blocks, id = NULL, ..., session = get_session())
}
\arguments{
\item{server, ui}{Server/UI for the plugin module}

\item{id}{Namespace ID}

\item{board}{The initial \code{board} object}

\item{...}{Extra arguments passed from parent scope}

\item{x}{The current \code{board} object}

\item{new}{Serialized (list-based) representation of the new board}

\item{result}{A \code{\link[shiny:reactiveVal]{shiny::reactiveVal()}} to hold the new board object}

\item{session}{Shiny session}

\item{blocks}{Block state reactive values}
}
\value{
A plugin container inheriting from \code{preserve_board} is returned by
\code{preserve_board()}, while the UI component (e.g. \code{preserve_board_ui()}) is
expected to return shiny UI (i.e. \code{\link[shiny:tagList]{shiny::tagList()}}) and the server
component a \code{\link[shiny:reactiveVal]{shiny::reactiveVal()}} evaluating to \code{NULL} or the \code{board} to
restore.
}
\description{
Board state can be preserved by serializing all contained objects and
restored via de-serialization. This mechanism can be used to power features
such as save/restore (via download, as implemented in the default
\code{preserve_board} plugin), but more refined user experience is conceivable
in terms of undo/redo functionality and (automatic) saving of board state.
Such enhancements can be implemented in a third-party \code{preserve_board}
module.
}
\details{
The \code{session$reload()} that a restore triggers is handled by the app's
\code{\link[=board_loader]{board_loader()}} (passed to \code{\link[=serve]{serve()}}), not by the plugin -- the plugin
server simply returns the \code{board} to restore and never reloads.
}
