Persist

With persist keyword, you can make changes on form persistent. This can be useful when you want to preserve prop values on browser refreshes, share filled form as link, share some filter settings etc.

Keyword

Type

type

'query', 'localStorage'

What type of storage to use.

key

string (optional)

Under what key to store value. If not set prop path is used.

For example key: 'abc' will be set in query as ?abc=123

loadMap

$eval (optional)

Mapper when retrieving the data from the persistence.

storeMap

$eval (optional)

Mapper when storing the data to persistence.

Example

When prop value is changed it will be also saved into URL under query key my-key. When the form is opened again URL query will be checked if the value can be retrieved.

{
    type: 'string',
    persist: {
        type: 'query',
        key: 'my-key'
    }
}

Persist has priority before default and advancedDefault.

Array edge cases

You can not use persists on array prop children, since all children will have the same key. Exception is a static array where you can manually set different keys. But you can easily set persist on array level or parent object.

Last updated

Was this helpful?