Skip to content

feat: [2312] Dashboard data store - Read from the store and remove the legacy datastore - #2316

Merged
n-lark merged 8 commits into
249-data-storefrom
2312-data-store-reads
Oct 20, 2026
Merged

n-lark merged 8 commits into
249-data-storefrom
2312-data-store-reads

Conversation

@n-lark

@n-lark n-lark commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Description

Last of three PRs moving reads onto the data store (#2239).

Widgets now read their saved data from the store, and the legacy datastore is removed. Widgets, including third-party ones, use the same API as before.

  • Some context storage settings: if Node-RED's context storage can't hold the store (e.g. cache: false), the dashboard keeps its own copy in memory instead, so it still works.
  • Errors: if the store can't be reached, the dashboard logs one warning. A widget's own errors still show on that widget.

Known regression: charts with a time limit are slower than on main, and page loads take about 2.5× as long. A follow-up PR will address this.

Test plan

  • The test harness shows the store on its own matches legacy after every step, including with the in-memory fallback
  • A live Node-RED shows the same widget data as main for the same messages, including after browser interactions, a reload and removing widgets
  • Third-party widgets keep working

Related Issue(s)

Resolves #2312

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Labels

  • Includes a DB migration? -> add the area:migration label

@n-lark n-lark self-assigned this Oct 16, 2026
@n-lark
n-lark changed the base branch from main to 2273-data-store-computes October 16, 2026 14:34
@n-lark
n-lark added this pull request to stack #2317 October 16, 2026 14:34
…it unchanged, and make the harness's warning checks real
Comment thread nodes/store/reactive.js
@n-lark
n-lark marked this pull request as ready for review October 19, 2026 15:58
@n-lark
n-lark requested a review from cstns October 19, 2026 15:58
@n-lark n-lark changed the title feat: Dashboard data store - Read from the store and remove the legacy datastore feat: [2312] Dashboard data store - Read from the store and remove the legacy datastore Oct 19, 2026

@cstns cstns left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thing that's new with this PR: a flow that clears all global context (e.g. for (const k of global.keys()) global.set(k, undefined)) now wipes every widget's state, charts included, and it stays empty after a reload. The warning in the log explains it well. On main that pattern never touched the dashboard, so it's maybe worth mentioning in the docs or release notes.

Comment thread nodes/store/data.js
try {
getOrCreateStore(node.context().global)[TRIM_SERIES](node.id, trim)
} catch (err) { warnOnce(node, `a store write failed (${err.message}), so global.dashboardStore may be out of date`) }
store = attachToContext(globalContext, attachOptions())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed something with a persistent context store (localfilesystem, cache: true). The store only gets written to disk when something else in global context is set, and then only the values go. After a restart my text input came back with its old value, which main never did, and the chart read back as { payload: [points] } instead of a list of msgs (20 points for a "last 5 per topic" chart). The chart showed empty and recovered on the next message, but a widget calling get() would see the odd shape. So whether state survives a restart ends up depending on an unrelated global.set. Might be worth picking one behaviour, either always starting fresh like main or persisting properly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yahh makes sense, went with starting fresh like main for now, which also fixes the chart coming back as { payload: [points] } here.

#2322 also keeps a chart's messages in step with its points for flow writes. I do want state to eventually survive restarts, but it can be settled in the persistence work #2237

Comment thread nodes/config/ui_base.js
if (!store) {
datastore.disableStore()
node.warn('Dashboard data store disabled: the global context store doesn\'t hold objects by reference (e.g. cache: false), so live state can\'t work. Use the memory store or localfilesystem with cache: true.' + (unavailable ? ' Reading it failed with: ' + unavailable.message : ''))
node.warn('Dashboard data store: flows can\'t use global.dashboardStore, because the default context store doesn\'t keep values in memory (e.g. localfilesystem with cache: false). Dashboards still work normally. To use global.dashboardStore from flows, set contextStorage.default to memory, or localfilesystem with cache: true.' + (unavailable ? ' (Reason: ' + unavailable.message + ')' : ''))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works nicely. I tried cache: false and the dashboard kept its data through a full redeploy. Minor: the warning shows on every full deploy, which might get a bit noisy for those users.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah good call fixed

@n-lark
n-lark requested a review from cstns October 20, 2026 18:07
Base automatically changed from 2273-data-store-computes to 249-data-store October 20, 2026 20:26
@n-lark
n-lark merged commit 9a0ce0f into 249-data-store Oct 20, 2026
4 checks passed
@n-lark
n-lark deleted the 2312-data-store-reads branch October 20, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashboard data store - Read from the store and remove the legacy datastore

2 participants