Skip to content
MyAppBuilder
StableData binding

App state

Overview

A variable shared by every page of the app for the current visit — the cart, the selected branch, a “compact mode” switch.

Purpose

Remember things across pages without saving them to the database. Declare variables under App state (key, type, default, optional persist), set them with Set state, read them anywhere.

Inputs

  • Data Picker group App state: one entry per declared variable (the group only appears once at least one variable exists).

Configuration

  • Turn on persist for a variable to keep it after a page reload (stored in the browser).
  • Templates: {{state.cartCount}} or {{app.cartCount}}; nested json values with dots.

Outputs

  • The variable's current value, with its declared type: string, number, boolean, json (object) or list.

Example

Cart badge

Example
App state: cartCount (number, default 0)
Button “Add to cart” › On click: Increase / decrease state  App state › cartCount  By 1
Badge › Text: {{state.cartCount}}

Errors

  • None. Keys not declared can still be set by actions but will not appear in the picker.

Limitations

  • Lives in the user's browser; it is not shared between users or devices and is not visible to workflows.

Advanced

  • { type: "app_state", key } with dotted keys allowed. Defaults come from project.appState; persisted keys are mirrored to localStorage under the runtime's persist key.

Related

Was this helpful?