# diffSnapshots

Compares two snapshots or a snapshot with current data. Omit the second ID to compare against current data.

Canonical: https://grid.syidax.com/docs/methods/diffSnapshots/

<a id="meaning"></a>

## What does this API do?

Compares two snapshots or a snapshot with current data. Omit the second ID to compare against current data.

<a id="contract"></a>

## Exact input and result types

```typescript
diffSnapshots(idA: string, idB?: string): Promise<SnapshotDiff<GridRow>>
```

| Arguments | Required | Type |
| --- | --- | --- |
| idA | Required | string |
| idB | Optional | string |

The return type is `Promise<SnapshotDiff<GridRow>>`.

<a id="usage"></a>

## Usage flow

After registering and initializing the Grid element, call grid.diffSnapshots(…). Read the return value with await. For methods returning a boolean or report, inspect the result before continuing.

<a id="types"></a>

## Read related types

- [SnapshotDiff](https://grid.syidax.com/docs/types/SnapshotDiff.md)
- [GridRow](https://grid.syidax.com/docs/types/GridRow.md)

<a id="recipes"></a>

## Feature explanations and examples

- [Data snapshot](https://grid.syidax.com/docs/features/snapshots.md) — Snapshots retain rowData at a point in time for comparison with current data or another snapshot. They differ from view-state APIs that save column widths, filters, and focus.
