# AdapTable State Guide

Canonical page: https://www.adaptabletools.com/docs/dev-guide-adaptable-state

- AdapTable State is the UI configuration for an instance: Layouts, searches, styles, and the other Module objects
- Developers ship [Initial Adaptable State](https://www.adaptabletools.com/docs/dev-guide-adaptable-state-initial-state/index.md) at design-time (a `Layout` section is required)
- First load merges that into User State; later loads restore the persisted User State
- Persistence is automatic (localStorage by default); most production apps replace it with remote `loadState` / `persistState`
- Some sections are transient and are never persisted

- AdapTable State does **not** include AG Grid data; it deals only with the AdapTable UI and associated objects
- Likewise AdapTable does **not** have access to the clients' private data

AdapTable State is how an instance remembers its configuration between sessions.

Developers populate [Initial Adaptable State](https://www.adaptabletools.com/docs/dev-guide-adaptable-state-initial-state/index.md) at design-time. Users then add, edit and delete objects at run-time. Those changes are persisted and re-applied on the next start.

Entitlements, options and other design-time settings that users cannot change live in [Adaptable Options](https://www.adaptabletools.com/docs/technical-reference-adaptable-options/index.md), not in State

## How AdapTable State Works

At design-time developers create [Initial Adaptable State](https://www.adaptabletools.com/docs/dev-guide-adaptable-state-initial-state/index.md).

This is a JSON object that contains the items the AdapTable instance requires for first use.

It consists of multiple sections — each relating to one Module in AdapTable.

Other sections are optional - with the exception of `Layout` which is required and must contain at least one Layout (unless [Default Layouts](https://www.adaptabletools.com/docs/handbook-layouts-default/index.md) are configured).

Some of the contents of each section are collections of Adaptable Objects (e.g. [Layouts](https://www.adaptabletools.com/docs/handbook-layouts/index.md)) but can also be string properties (e.g. name of the Current Layout).

When the application loads for the **first time**, the [Initial Adaptable State](https://www.adaptabletools.com/docs/dev-guide-adaptable-state-initial-state/index.md) is read into memory.

This Initial State is then stored as AdapTable State and is updated (and automatically persisted) with any user state that is created during that session.

It can be stored locally or remotely depending on your settings.

Each later launch retrieves that persisted User State and pre-populates the AdapTable instance with it.

Users see the same configuration they had on their previous visit.

The [Revision](https://www.adaptabletools.com/docs/dev-guide-adaptable-state-updating-initial-state/index.md) property lets you update a section of Initial State **after** go-live without wiping the rest of User State

## What is Persisted

Most of AdapTable State is persisted. That persisted object is the Initial State sections plus [Team Sharing](https://www.adaptabletools.com/docs/handbook-team-sharing/index.md) (Team Sharing is run-time only — it is not part of Initial State).

These sections are **transient**: they exist in the in-memory store but are never written by `persistState`:

- `Internal`
- `Popup`
- `Comment`
- `Plugins`

## Default AdapTable State

AdapTable State is almost entirely empty when the Application starts for the first time.

It is then populated by the supplied [Initial Adaptable State](https://www.adaptabletools.com/docs/dev-guide-adaptable-state-initial-state/index.md).

A few defaults are provided for convenience:

All of these can be replaced by properties in Initial Adaptable State if necessary

| Module                                                           | Default Property Description                                         |
| ---------------------------------------------------------------- | -------------------------------------------------------------------- |
| [Dashboard](https://www.adaptabletools.com/docs/ui-dashboard/index.md)             | `ModuleButtons` is an empty list                                     |
| [Quick Search](https://www.adaptabletools.com/docs/handbook-quick-search/index.md) | Default highlight style (black text on yellow)                       |
| [Theme](https://www.adaptabletools.com/docs/handbook-theming/index.md)             | Current Theme is set to `light`                                      |
| [Tool Panel](https://www.adaptabletools.com/docs/ui-tool-panel/index.md)           | A *SettingsPanel* Button is provided in the `ModuleButtons` property |

## Redux

Internally AdapTable uses [Redux](https://redux.js.org/) to manage its state.

This provides a uni-directional store for all the objects used in the grid.

If using Redux in your application, continue to maintain your own Store; merging the 2 Stores can cause complications

## Pages in this Section

The pages follow the State lifecycle:

1. **Provide** Initial State
2. **Persist** User State
3. **Update** Initial State after go-live
4. **Customise**, **suspend** and **listen**
5. **Manage** in the UI, **migrate** between versions, then **React hooks** and the **API**

<section className="my-8 sm:my-10 grid grid-cols-1 lg:grid-cols-2 gap-x-8 gap-y-4">
    <div className="flex flex-col justify-center">
        
    </div>
    <div className="flex flex-col justify-center">
        
    </div>
    <div className="flex flex-col justify-center">
        
    </div>
    <div className="flex flex-col justify-center">
        
    </div>
    <div className="flex flex-col justify-center">
        
    </div>
    <div className="flex flex-col justify-center">
        
    </div>
    <div className="flex flex-col justify-center">
        
    </div>
    <div className="flex flex-col justify-center">
        
    </div>
    <div className="flex flex-col justify-center">
        
    </div>
    <div className="flex flex-col justify-center">
        
    </div>
</section>

### FAQ

**Where is AdapTable State stored?**
By default it is stored in the browser's local storage, under `adaptableStateKey` (which defaults to `adaptableId` if you omit it). Use the State Options functions to save State in any location you specify (and to enrich it en route).

**Do you provide data adapters to fetch / save AdapTable State?**
No we don't, you will need to provide the mechanism to store your State in a remote location.
There are simply too many different storage locations and mechanisms for us to provide connectors.

**Does AdapTable persist everything in the Redux store?**
No. `Internal`, `Popup`, `Comment` and `Plugins` are transient and never written by `persistState`.
