# getDirtyPaths

> This document is the Markdown version of [formisch.dev/methods/api/getDirtyPaths/](https://formisch.dev/methods/api/getDirtyPaths/). For the complete documentation index, see [llms.txt](https://formisch.dev/llms.txt).

Returns a list of paths to dirty fields in the form. Object branches are recursed into; arrays are treated as atomic — when any descendant of an array is dirty, only the array's own path is returned.

```ts
const paths = getDirtyPaths<TSchema>(form);
const paths = getDirtyPaths<TSchema, TFieldPath>(form, config);
```

## Generics

- `TSchema` `extends FormSchema`
- `TFieldPath` `extends RequiredPath | undefined = undefined`

## Parameters

- `form` `BaseFormStore<TSchema>`
- `config` `GetFormDirtyPathsConfig | GetFieldDirtyPathsConfig<TSchema, TFieldPath> | undefined`

### Explanation

The `form` parameter is the form store to inspect. The optional `config` parameter scopes the search to a single subtree via its `path` property. Object branches are recursed into and clean keys are omitted; arrays are atomic, so when any descendant of an array is dirty, the result includes the array's own path rather than the paths of its individual items. Returns an empty array if the inspected subtree contains no dirty fields. When `path` targets a dirty array or value field, the result contains that path.

Internally, the function collects the paths in a single recursive walk that visits each field at most once, so the cost is linear in the number of fields in the inspected subtree.

## Returns

- `result` `DirtyPath<v.InferInput<TSchema>>[]`

## Related

### Methods

[`getDirtyInput`](/methods/api/getDirtyInput.md), [`getInput`](/methods/api/getInput.md), [`pickDirty`](/methods/api/pickDirty.md)
