Skip to content

Sidebar: refresh Resource Utilization with a button, not a timer - #157

Closed
t0mdavid-m wants to merge 1 commit into
developfrom
claude/project-thread-rfg7be-sidebar-refresh
Closed

t0mdavid-m wants to merge 1 commit into
developfrom
claude/project-thread-rfg7be-sidebar-refresh

Conversation

@t0mdavid-m

Copy link
Copy Markdown
Member

Before: on the live deployment, switching pages sometimes left a blank page with "Bad 'setIn' index N" in the console, and the session's later pages timed out. The sidebar's Resource Utilization panels reran themselves every 5 seconds.

After: the panels update with every page rerun and when you click the new Refresh button inside the expander. Nothing reruns on a timer, so page switches no longer crash.

Port of OpenMS/streamlit-template#474. When a 5-second timer fired while the user switched pages, its rerun carried the page being left. The server ran it after the new page, the browser read it as a page change and cleared the page, and then received the panel's elements for a sidebar it no longer had. The window is one network round trip, which is why it showed online and not locally.

How: the three monitors lose @st.fragment(run_every=5) and the _keep_fragment_non_empty() workaround. They are drawn from one plain @st.fragment (_resource_panels) that holds the Refresh button. tests/test_sidebar_monitors.py gains a check that none of them reruns on a timer. Workspace Sync's own timers (developer mode only) and the FLASHIda live viewer are unchanged.


Generated by Claude Code

Port of OpenMS/streamlit-template#474. The sidebar monitors reran
themselves with st.fragment(run_every=5). When that timer fired as the
user switched pages, the rerun carried the page being left; the server
ran it after the new page, the browser took it for a page change,
cleared the page, and then got the panel's elements for a sidebar it no
longer had ("Bad 'setIn' index"). The window is one network round trip,
so it crashed online deployments and not local runs.

The panels now sit in one fragment with a Refresh button and update
with every page rerun.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KyJg47YNaoYnCCj1QYkHEy

Copy link
Copy Markdown
Member Author

Closing as superseded: #156 (Sync with template 26d7a41) already brings in OpenMS/streamlit-template#474 unchanged, with the same _resource_panels fragment and test, so this port would only conflict with it.


Generated by Claude Code

@t0mdavid-m t0mdavid-m closed this Nov 4, 2026
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.

2 participants