Skip to main content
FlowDrop uses Svelte 5 runes for reactive state management. Each mounted editor owns an isolated FlowDropInstance container holding its stores. While most developers won’t need to interact with stores directly, they’re essential for advanced integrations.

Reaching a store

There are no module-level store functions — instances are the API. Reach a store one of two ways:
  • getInstance() inside a FlowDrop component returns the owning FlowDropInstance. For single-editor embeds it resolves the page-default instance automatically.
  • The mount handle’s .instance (const fd = (await mountFlowDropApp(...)).instance) lets you reach a specific editor’s stores from vanilla JS or another framework. You can also construct one with createFlowDropInstance({ id }) from @flowdrop/flowdrop/editor and pass it as the instance prop.
The instance exposes these members: See the multiple instances guide for scoping multiple editors.

Workflow store (fd.workflow)

The central store holding the current workflow state.

Reading state

Modifying state

Dirty state

History store (fd.historyBindings)

Manages undo/redo with snapshot-based history. fd.historyBindings is the reactive rune wrapper around fd.history (the underlying HistoryService).

Settings store

User preferences for theme, editor behavior, and UI. Settings are page-global by design — they are not instance-scoped, so these remain module-level functions.

Theme control

Theme is also page-global:

Playground store (fd.playground)

Manages interactive testing sessions and messages.

Interrupt store (fd.interrupts)

Manages human-in-the-loop interrupt state.

Using stores in Svelte components

Since stores use Svelte 5 runes, read their getters inside $derived:

Using stores outside Svelte

For vanilla JS or other frameworks, hold the mount handle’s .instance and read its getters at call time:
For event-driven updates, use the event system instead of polling: