# UpdateSource

> _Since v1.0.0_

Indicates the origin of a data change.
Used to prevent infinite loops in cascade update handlers.

- `'user'`: Direct user interaction via EditingPlugin (typing, selecting)
- `'cascade'`: Triggered by `updateRow()` in an event handler
- `'api'`: External programmatic update via `grid.updateRow()`

```ts
type UpdateSource = "user" | "cascade" | "api"
```

#### Example

```typescript
grid.on('cell-change', (detail) => {
  const { source, field, newValue } = detail;

  // Only cascade updates for user edits
  if (source === 'user' && field === 'price') {
    // Update calculated field (marked as 'cascade')
    grid.updateRow(detail.rowId, {
      total: newValue * detail.row.quantity,
    });
  }

  // Ignore cascade updates to prevent infinite loops
  if (source === 'cascade') return;
});
```

## See Also

- [`CellChangeDetail`](/grid/api/core/interfaces/cellchangedetail.md) for the event detail containing source
