# PipelineStage (@salmonui/data-grid/engine)

> The PipelineStage interface of @salmonui/data-grid/engine.

Canonical: https://salmonui.dev/docs/reference/data-grid/engine/PipelineStage

```ts
import type { PipelineStage } from '@salmonui/data-grid/engine';
```

Entry index: https://salmonui.dev/docs/reference/data-grid/engine (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/data-grid/engine.md).

## Reference

Kind: interface

```ts
interface PipelineStage<Row, State = unknown> {
    readonly name: PipelineStageName;
    key(query: DataQuery, state: State): readonly unknown[];
    run(input: RowModelSnapshot<Row>, ctx: StageContext<Row, State>): RowModelSnapshot<Row>;
    update?(input: RowModelSnapshot<Row>, previous: {
        readonly input: RowModelSnapshot<Row>;
        readonly output: RowModelSnapshot<Row>;
    }, delta: RowDelta, ctx: StageContext<Row, State>): RowModelSnapshot<Row> | undefined;
}
```

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `name` | `readonly name: PipelineStageName;` |  |  |
| `key` | `key(query: DataQuery, state: State): readonly unknown[];` |  | Inputs besides the row model and compiled columns. The stage re-runs only when the row model identity, the compiled leaf columns, or one of these values (compared with `Object.is`) changes. |
| `run` | `run(input: RowModelSnapshot<Row>, ctx: StageContext<Row, State>): RowModelSnapshot<Row>;` |  | Pure. Must not mutate `input`; return `input` itself when nothing changes. |
| `update` | `update?(input: RowModelSnapshot<Row>, previous: {     readonly input: RowModelSnapshot<Row>;     readonly output: RowModelSnapshot<Row>; }, delta: RowDelta, ctx: StageContext<Row, State>): RowModelSnapshot<Row> \| undefined;` | optional | Optional incremental path. Called instead of `run` when the stage key and the compiled leaves are unchanged, every earlier stage was also updated incrementally (or passed its input through), and the source rows changed only by `delta` since the stage last ran. `previous` holds the stage's last input and output (indexes in the previous source array). Must return exactly what `run(input, ctx)` would return, or undefined to fall back to `run`. |
