Skip to content
English

Redux

The Redux panel has three tabs. State shows your store’s current state and lets you edit its values. Actions lists every action with a diff, and can unwind the store to any of them. Dispatch sends an action with a payload you enter.

Setting up Redux in the SDK

The Redux panel's State tab with a nested object expanded

The State tab shows your store’s state as a tree. Use Expand all and Collapse all to open or close every branch, and Copy to copy the whole state as JSON.

Values that aren’t JSON are shown as text: a function as ƒ name(), a Date as an ISO string, and undefined as undefined. A Map shows as an object and a Set as an array.

Type in Filter state… to find keys and values that contain the text, ignoring case. Matches are highlighted and their branches open.

Type a full path, such as case.caseNumber, to show only that value. Array items are numbered, as in suspects.names.0. As you type a path, the keys at that level are suggested.

Double-click a string, number, boolean or null to edit it, or tab to it and press Enter. A string takes any text. Other values take a JSON value, so to change a number into a string, type it in quotes.

Hover an array to change its items:

  • Add item on the array adds an item at the start.
  • Add item after… on an item adds one after it.
  • Remove item removes the item.

When you add an item, choose String, Number, Boolean or Null, then edit its value. Keys can’t be added to or removed from objects, and functions and other non-JSON values can’t be edited.

Each edit replaces the state in your app without running your reducers, and appears in Actions as @@xerlock/edit.

The Actions tab with an action selected and its diff open in the details pane

The Actions tab lists every action, with the newest at the bottom. Each shows its time, its type in bold, a summary of its payload, and how long it took. The list follows new actions while you’re scrolled to the bottom.

Type in Filter actions… to show actions whose type or payload contains the text, ignoring case. Filter by type lists every type in the log with its count. Turn a type off to hide it, or click Show all. While a filter hides actions, Clear filters shows them again. Clear actions empties the list.

Select an action to open it:

  • Diff lists each value that was Added, Removed or Changed, with its before and after values.
  • Before and After show the whole state either side of the action.
  • Payload shows the action itself.

The list is kept when your app reloads. Before and after states are kept for the last 200 actions, and only until your app reloads or reconnects. For other actions, the pane shows “State for this change is no longer available.”

Unwind to here, on an action or in its details pane, returns the store to its state right after the action. Later actions are removed from the list, and the unwind isn’t added as an action.

The Dispatch tab with an action type selected, its payload prefilled, and a recent dispatch listed

On the Dispatch tab, choose a type in Select an action type…, or type a new one and choose Use ‘…’. Types from actions are marked registered, and those with a dispatchable() template are marked template. Types from the log show how many times they were dispatched.

Choosing a type fills the editor with its template, or with the payload of its last action in the log. Edit the rest of the action as a JSON object without type, such as { "payload": "Irene Adler" }. An empty editor sends just the type. Then click Dispatch.

You’ll see “Dispatched …” and the action appears in Actions. If a reducer or middleware throws, you’ll see “Couldn’t dispatch the action” instead.

Recent dispatches lists the last 10 successful dispatches. Dispatch again repeats one, and Edit loads it into the editor.

  • Xerlock shows one Redux store per app.
  • Before and after states are kept for the last 200 actions. Older actions can’t be diffed or unwound to.