PhoenixReplay.Recording.State (PhoenixReplay v0.6.2)

Copy Markdown View Source

Client state on a recording's timeline.

:state events are stored as the batches the browser sent; see PhoenixReplay.Capture.State. spread/1 turns each into one :state event per entry, %{key: String.t(), changes: map}, at its own offset from the session's start: the batch arrived at its event's at, and its entries span the span milliseconds before that. The player then steps through them like any other event, and PhoenixReplay.Recording.Timeline merges each entry's changes into the :phoenix_replay_state assign, %{key => merged changes}, which a view's replay_render/1 reads. See assign/0.

The values of form controls the browser records on its own are kept under inputs_key/0, %{selector => %{name => value}}; the replay frame puts them back into the replayed page after each render.

Summary

Functions

Merges a :state event's changes into the state replayed so far.

The reserved assign the replayed state is merged into: a map of each key's merged changes, with string keys, empty before any state.

The form control values in replayed state, as inputs_key/0 describes.

The key form control values are recorded under: a map of each control's selector to %{name => value}, where the value is its text, whether it is checked, or the options chosen.

Places each entry of the recording's :state batches on its timeline as a :state event of its own. The other events keep their order; an entry goes before the first of them that happened after it. Recordings already spread are returned as they are.

Functions

apply(state, event)

@spec apply(map(), PhoenixReplay.Recording.Event.t()) :: map()

Merges a :state event's changes into the state replayed so far.

assign()

@spec assign() :: atom()

The reserved assign the replayed state is merged into: a map of each key's merged changes, with string keys, empty before any state.

inputs(state)

@spec inputs(map()) :: map()

The form control values in replayed state, as inputs_key/0 describes.

inputs_key()

@spec inputs_key() :: String.t()

The key form control values are recorded under: a map of each control's selector to %{name => value}, where the value is its text, whether it is checked, or the options chosen.

spread(recording)

Places each entry of the recording's :state batches on its timeline as a :state event of its own. The other events keep their order; an entry goes before the first of them that happened after it. Recordings already spread are returned as they are.