blokboard/ Open app

EXAMPLE 04 OF 16 · Starter

Remember a value

Read a workflow State key, save a message, and confirm that the next run remembers it.

BrowserStatePersistenceBeginner

Before you begin#

  • Use the Browser runtime and keep browser storage available. This example only writes the greeting key in its own workflow State.

WORKFLOW SNAPSHOT

Remember a value

4 nodes

Interactive workflow preview loads here. Download the JSON to inspect it in the app.

Import creates an inactive copy. Set your own inputs and connections before running.

Opens as a new, inactive workflow. Review the nodes before running.

Walk through the workflow#

  1. Import a new copy and run it once. The first Get State node reports found: false because the copy starts with no saved greeting.
  2. Set State saves the text Hello from a previous run. The final Get State reads it back with found: true.
  3. Run the same workflow again. The first Get State now finds the saved value before the write occurs.
  4. To start fresh, import another copy. State belongs to each workflow and the runtime where it runs; it is not included in downloaded files.

Compare two runs#

On a fresh copy, the first read reports found: false. The last read reports found: true and value: Hello from a previous run. On the second run, the first read also finds that saved value.

Make one change#

Add Delete State after the final read with Key set to greeting. On the next run, the first read should report found: false again.

If it does not match#

Use the same workflow copy and runtime for both runs. State is local to that pair. Importing another copy or changing runtimes gives you different State; exporting a workflow does not carry stored values.