lean-ctx icon indicating copy to clipboard operation
lean-ctx copied to clipboard

Feature Request: Dashboard UI auto-refresh

Open ITFinesse opened this issue 5 months ago • 3 comments

Summary

The dashboard at http://localhost:3333 does not automatically refresh its data. Stats and metrics remain static until the page is manually reloaded.

Steps to Reproduce

  1. Run lean-ctx dashboard
  2. Open http://localhost:3333 in browser
  3. Perform several AI agent tool calls (ctx_read, ctx_search, etc.)
  4. Observe dashboard — token savings, call counts, and other metrics do not update
  5. Manually reload the page — stats then update correctly

Expected Behaviour

The dashboard should auto-refresh its data periodically (e.g. every 5–30 seconds) so live session stats are visible without requiring a manual page reload.

Actual Behaviour

Dashboard UI remains static. No auto-refresh occurs. A manual browser refresh is required to see updated stats.

Environment

  • OS: Windows
  • lean-ctx version: v3.8.6
  • Browser: VS Code Simple Browser / external browser

ITFinesse avatar Jun 15 '26 14:06 ITFinesse

I try to find a way to configure this, because some people do not like the auto refresh thing :D

yvgude avatar Jun 15 '26 14:06 yvgude

Simple drop down with none, 5s , 10s, 30, 1m, 5m would suit. Also save to config so we don't have to always select it every time.

Appreciate your work.

ITFinesse avatar Jun 15 '26 14:06 ITFinesse

Fixed on main (abfd20287), shipping in v3.8.7.

Root cause: the dashboard polled /api/pulse every 10s, but on a content change it only refreshed the status bar and flagged the manual refresh button (has-update pulse). The main panels reload on the lctx:refresh event, which only the manual button dispatched — so stats/metrics stayed static until you reloaded.

Now:

  • when the poll detects a content change and the tab is visible, it dispatches lctx:refresh, so the active view reloads its data in place (UI state/scroll preserved) on the normal cadence;
  • a visibilitychange handler refreshes immediately when the tab regains focus, so returning to the dashboard never shows stale data;
  • hidden tabs still just flag the button (no churn) and catch up on return.

So live session stats now update on their own within ~10s without a manual reload. Closing as fixed — please reopen if you still see staleness on v3.8.7.

yvgude avatar Jun 15 '26 14:06 yvgude