[**@wocart/theme v4.1.0**](../../README)

***

[@wocart/theme](../../README) / [index](../README) / PreviewPatch

# Type Alias: PreviewPatch

> **PreviewPatch** = \{ `id`: `string`; `index`: `number`; `op`: `"move"`; `parent?`: `string`; \} \| \{ `id`: `string`; `ids`: `Readonly`\<`Record`\<`string`, `string`\>\>; `op`: `"duplicate"`; \} \| \{ `id`: `string`; `op`: `"remove"`; \} \| \{ `id`: `string`; `index`: `number`; `op`: `"restore"`; `parent?`: `string`; \} \| \{ `hidden`: `boolean`; `id`: `string`; `op`: `"hide"`; \} \| \{ `from`: `string`; `id`: `string`; `op`: `"text"`; `to`: `string`; \}

A change the editor has already made to its draft, for the page to show at
once, before the `render` that follows it. A patch is a hint: the page
applies what it can find and leaves the rest to that render, which is the
page's truth — so an editor always sends the render too, and a page that
does not know patches (before `@wocart/theme` 1.6.0) still shows every
change, a moment later.

- `move`: an instance to `index` among its siblings, counted once it has
  left its place (`moveInstance`): the document's sections, or with
  `parent` the blocks of that instance. A move to another parent is left to
  the render.
- `duplicate`: a copy of an instance right after it; `ids` maps every
  instance id inside it, its own included, to its copy's.
- `remove`: an instance and everything in it; `restore` puts what a
  `remove` took back at `index` among the sections, or among `parent`'s
  blocks.
- `hide`: an instance switched off (it shows nothing) or back on.
- `text`: inside an instance, text that reads `from` now reads `to` — a
  field's text as the theme prints it.
