---
title: "DataState"
description: "The state a data surface is in, named once so the surfaces converge on one vocabulary, though no component accepts it yet."
url: "https://opsinjs.pensievelabs.org/reference/api/DataState"
source: "https://opsinjs.pensievelabs.org/reference/api/DataState.md"
section: "Reference"
kind: "reference"
---

> Elements written as `<PascalCase … />` below are opsinjs documentation
> components. Their attributes are the content: the values they render are
> generated from `tokens/*.json` and `registry/catalogue.ts` and are
> published separately at https://opsinjs.pensievelabs.org/r/index.json and under the Reference
> section.
> Nothing is missing from this page. The data simply does not live in
> the prose.

{/* GENERATED - do not edit. Source: the declaration named in the table below.
    Script: scripts/build-reference.mts. Change the doc comment on the symbol. */}

<PageTemplate kind="reference" />

## How this is generated [#how-this-is-generated]

Source: `lib/opsinjs.ts`. Script: `scripts/build-reference.mts`. Command:
`pnpm run generate`.

Everything below is copied from the symbol, so a page is improved by improving
its doc comment. The [API index](./index.mdx) says why there is a page per
symbol and what these pages still do not carry.

{/* opsinjs:generated:begin - everything below is replaced by scripts/build-reference.mts */}

## DataState [#datastate]

The state a data surface is in, named once so the surfaces converge on one vocabulary, though no component accepts it yet.

These are the five states the Data states foundation names, which are loading, error, empty, partial and stale, plus the resolved case where the value is real, current and simply rendered. The members are listed with the five doctrine states first and resolved last; the order a surface actually moves through them is the resolution order the foundation's flow diagram fixes, which is error first, then loading, empty, partial, stale and finally resolved.

No component accepts this type yet. It exists so that when the data surfaces do converge on a single state input they converge on one set of names rather than six, and because lib/opsinjs.ts is the substrate `shadcn add` copies into a consumer's project, a type declared here already travels with every installed component and costs nothing at runtime. Turning this alias into a running state machine, with a prop, a guard and a default, is a larger change this name does not stand in for.

| Kind | Declared in      |
| ---- | ---------------- |
| type | `lib/opsinjs.ts` |

```ts
export type DataState =
  | "loading"
  | "error"
  | "empty"
  | "partial"
  | "stale"
  | "resolved"
```

{/* opsinjs:generated:end */}
