Skip to content

update the dashboard in place instead of blanking it every 30 seconds - #11

Merged
teian merged 2 commits into
mainfrom
fix/ui-refresh-in-place
Aug 19, 2026
Merged

teian merged 2 commits into
mainfrom
fix/ui-refresh-in-place

Conversation

@teian

@teian teian commented Aug 19, 2026

Copy link
Copy Markdown
Owner

The dashboard looked like it reloaded itself twice a minute. It never did —
there is no location.reload anywhere — but the effect was the same, because
the periodic poll emptied the views before refilling them.

Three causes, all on the 30-second timer:

  • HistoryChart called setHistory(null) at the top of its fetch effect, so
    the chart was replaced by the "loading" line for the length of the request
    and then re-entered with its 500 ms animation.
  • DiagnosticsView did the same with setDiagnostics(null), and its effect
    runs on refreshKey, which the status poll bumps every 30 seconds.
  • A failed status poll called setStatus(null), so one missed request emptied
    the cards and the header.

What changes

Both views keep what is on screen while the next payload is fetched. They empty
themselves only when the query identity changes — range, inverter, day/week/
month/year — where showing the previous period's numbers under the new heading
would be wrong rather than merely stale. Each tracks the query its current data
belongs to and compares before clearing.

The chart series animate on the first payload of a chart and swap values
silently afterwards (isAnimationActive follows that flag), so a refresh
updates the curve without replaying the entry animation.

A failed poll keeps the last reading. ServiceStatus gains an offline prop
and shows a badge beside the version, so a network hiccup costs a badge instead
of the whole page. The cards still say "connecting" until the very first
response arrives.

SystemView already merged pages into its ring and needed no change; it clears
only when a filter changes, which is a query change and correct.

Testing

pnpm test and pnpm run build pass, and the dashboard type-checks.

Not verified against a running instance — this machine has no smalog database
to serve the dashboard from, so the change is reasoned from the render path
rather than observed. What to look for on the Pi: the chart and the diagnostics
tables should now change values without going blank, and pulling the network
should leave the numbers standing with an offline badge in the header.

teian added 2 commits August 19, 2026 15:10
Every 30 seconds the poll timer replaced what was on screen with a
"loading" line before the new data arrived: the chart effect cleared its
history, and the diagnostics view cleared its tables, on every run rather
than only when the query changed. The chart then re-entered with its 500 ms
animation. Taken together that reads as the page reloading itself twice a
minute.

Both views now keep what they show while the next payload is fetched, and
only empty themselves when the range, inverter or period actually changes —
where stale data would be wrong rather than merely old. The chart series
animate on their first payload and swap values silently afterwards.

A failed poll no longer empties anything either. The status cards keep the
last reading and the header gains an offline badge, so a network hiccup
costs a badge rather than the whole page.
@teian
teian merged commit 806af2b into main Aug 19, 2026
12 checks passed
@teian
teian deleted the fix/ui-refresh-in-place branch August 19, 2026 13:33
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.

1 participant