Skip to main content

Persisted state

Use this page to turn a product requirement into a storage decision. First decide what users must be able to restore. Then wire the public state object that owns that information. The Backend integration guide separately explains how to store the selected objects.

Choose what users can restore

Product requirementPublic stateWhat the integrator must decideGuide
Reopen one named chart workspace and reapply saved content to its mounted chartsChartLayoutGive the chart layout and each mounted chart a stable id; choose whether drawings travel inside itChart workspace layouts
Reopen a composed terminal with the same panels, tabs, groups, sizes, and widget parametersWidgetLayoutStateGive the widget panel arrangement a stable identity and keep its lifecycle independent from chart layoutsWidget panel arrangements
Share, version, or update drawings independently from a chart layoutDrawingStateUse separate drawing storage and define the sharing bucketDrawing storage
Let users apply a reusable chart, indicator, or drawing preset elsewhereChartTemplateEnable only the template kinds the product exposesTemplates
Keep preferences when users switch chart layoutsUserSettingsStateDefine which values are per user or workspace instead of chart-layout-specificUser settings
Resume one chart's replay cursor, status, and speedReplayStateDefine the chart context whose replay session should returnReplay state

Do not persist an object merely because the SDK exposes it. If the product does not promise that result after a reload, leave that storage capability out.

Keep independent lifecycles independent

A composed Trading Terminal commonly needs both ChartLayout and WidgetLayoutState: the chart layout restores chart content, while the widget panel arrangement restores the product shell around it. Saving, replacing, or deleting one must not imply the same operation for the other.

Drawings are embedded in a chart layout by default. Use DrawingState only when drawings need separate sharing, revision, deletion, or synchronization behavior. A template is reusable input; it is not the identity of the chart workspace to which it is applied. User settings survive chart-layout changes and therefore do not belong in ChartLayout.metadata.

Keep live authorities out of persisted state

InformationCorrect ownerWhy it is separate
Keyboard shortcutsHotkeyStorageAdapterKey bindings have their own user scope and sharing lifecycle
AlertsAlertProviderAlerts are active backend jobs, not passive chart JSON
Image drawing filesChartImageStorageAdapterBinary assets are uploaded separately from chart-layout, drawing, or template JSON
Market data and trading stateDatafeed and broker backendsThese systems remain the live authorities for prices, orders, positions, and accounts

chart.getState() may expose a broader runtime snapshot than any one public storage object. Do not persist that snapshot as a substitute for the storage contracts above.

Next steps