Where a surface's state survives a reload, a new page or a later visit (spec/03 §3): a host behavior, chosen by the host, since it is a privacy and deployment decision.
A persistence moves text: store/3 writes a surface's values, each the text
Macaw.State.persist/3 wrote, into its carrier under the surface's name, and load/2
reads them back for Macaw.State.restore/3, which judges every value as untrusted
input. Three ship:
Macaw.State.Persistence.None, the default: nothing is stored, nothing loads;Macaw.State.Persistence.Url: the carrier is a params map as Phoenix decodes a query string and encodes one (handle_params/3's params, a verified route's query), the values nested under the surface's name;Macaw.State.Persistence.Session: the carrier is a session map, the values under the surface's name, for state that must not go in a URL.
Persistence is for interaction state only, never for domain data.
Summary
Callbacks
The values stored for the surface key, or %{}; any term, read as untrusted.
The carrier with the surface key's values written, replacing what it held.
Types
Callbacks
The values stored for the surface key, or %{}; any term, read as untrusted.
The carrier with the surface key's values written, replacing what it held.