> Documentation index: https://www.gooddata.ai/docs/gooddata-ui/llms.txt lists every page of these docs as Markdown.

# IUndoLayoutChangesPayload

- Package: [@gooddata/sdk-ui-dashboard](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/index.md)
- Kind: interface
- Stability: beta
- Source: https://github.com/gooddata/gooddata-ui-sdk/blob/rel/11.64/libs/sdk-ui-dashboard/src/model/commands/layout.ts

> **Beta API.** Mostly stable, but details may change in a minor release, outside SemVer. See [API maturity](https://www.gooddata.ai/docs/gooddata-ui/latest/integrations/platform/api-maturity/index.md).
> 

Payload of the [IUndoLayoutChanges](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.iundolayoutchanges/index.md) command.

**Signature:**

```typescript
export interface IUndoLayoutChangesPayload 
```

## Properties

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [undoPointSelector?](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.iundolayoutchangespayload/index.md#iundolayoutchangespayloadundopointselector) | `readonly` | [UndoPointSelector](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.undopointselector/index.md) | **_(BETA)_** _(Optional)_ Specify a function that will be used to select a command up to which the undo should be done. |

## Property details

### IUndoLayoutChangesPayload.undoPointSelector

> **Beta API.** Mostly stable, but details may change in a minor release, outside SemVer. See [API maturity](https://www.gooddata.ai/docs/gooddata-ui/latest/integrations/platform/api-maturity/index.md).
> 

Specify a function that will be used to select a command up to which the undo should be done.

**Signature:**

```typescript
readonly undoPointSelector?: UndoPointSelector;
```

#### Remarks

If not provided then the default selector will be used and will undo the very last command.

The undo point selector is essential if you are implementing complex user-facing features that are achieved using multiple commands. For instance drag-and-drop. On drag start, an item is removed - that is one command, and then user drops the item at the new location - that is another command. The commands are dispatched by your code separately, yet if user is able to do undo drag-and-drop operation, you need to get layout to a point before

If you want to trigger a proper undo in this case, then you need to undo both commands. Building on the example above, you can proceed as follows:

- Your drag-and-drop feature should use correlationId convention to tie commands to user-facing feature. - Upon interaction start, your feature computes a correlationId `prefix` = "dnd-<UUID>" - The first command to remove the dragged item from layout will have correlationId = `${prefix}-drag` - The second command to add the dropped item to a new place on layout will have correlationId = `${prefix}-drop` - When the user clicks 'Undo', you dispatch the UndoLayoutChanges with a greedy selector. This will check whether  the last command is a 'drop' in the dnd interaction. If so, look at previous command, check if it matches  the correlationId and if so undo up to and including that command.
