Skip to content

fix(performance): reduce unnecessary reruns and improve dashboard responsiveness#43

Merged
Codex-Crusader merged 3 commits intoThe-Pulse-Engine:mainfrom
shruthikha:main
Apr 14, 2026
Merged

fix(performance): reduce unnecessary reruns and improve dashboard responsiveness#43
Codex-Crusader merged 3 commits intoThe-Pulse-Engine:mainfrom
shruthikha:main

Conversation

@shruthikha
Copy link
Copy Markdown
Contributor

Reduced unnecessary Streamlit reruns by removing forced st.rerun() calls.
Improved dashboard responsiveness by controlling background scan triggers.
Added optional auto-scan toggle and prevented redundant refresh cycles.
Result: smoother UI, reduced lag, and better caching efficiency.

Removed forced full reload on data refresh and updated auto scan functionality.
@shruthikha
Copy link
Copy Markdown
Contributor Author

Heyy!! I have tested these changes locally and made sure that it improves the UI responsiveness and reduced unnecessary reruns...

@Codex-Crusader
Copy link
Copy Markdown
Collaborator

Hello, Nice work and thank you for contributing

Have you checked other parts of the dashboard regarding minor exceptions or exception leaks and unassigned data for this?
Since a toggle might have been added but it affects other files too. so according to PEP8 coding standards (as mentioned in the contributing.md) these are also pre-requisites.

please do check and revert to us before we merge your branch.
thank you.

Copy link
Copy Markdown
Collaborator

@Codex-Crusader Codex-Crusader left a comment

Choose a reason for hiding this comment

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

Change 1 - Auto-scan checkbox: Widget is declared after it's read; move the st.sidebar.checkbox above the if block to avoid ordering fragility.

Change 2 - Removed st.rerun() after scan: This breaks the UI refresh — the comment above literally says a rerun is needed to pick up fresh data. Use st.fragment or a conditional rerun instead of removing it entirely.

Change 3 - Stale data st.info: Good direction, but pair it with a st.button("Refresh now") so the user has an actual way to act on the message.

Change 4 - "Load news feed" button: Removing st.rerun() here makes the button feel broken, session state is set but the news section won't render until the next unrelated interaction.

Change 5 - "Load live data" button: Same issue as above; the spinner below never triggers on the same click without a rerun.

General: Avoid emoji in source comments (# ❌) , encoding issues in some CI/editor setups. The overall strategy is inconsistent: some changes are solid UX improvements, but the rerun removals in changes 2, 4, and 5 trade correctness for perceived performance gains.

@shruthikha
Copy link
Copy Markdown
Contributor Author

Heyyy!! Thanks for the detailed feedback

I've addressed all the requested changes:

-> Moved the auto-scan checkbox above its usage
->Restored necessary rerun behavior where required
-> Ensured "Load news feed" and "Load live data" buttons trigger UI updates correctly
-> Improved stale data handling with a user-triggered "Refresh now" button
->Standardized _scan_refresh_epoch updates using st.session_state for consistency
->Removed emoji from source comments

Please take another look when you have time. Happy to make further improvements if needed!!!

@Codex-Crusader Codex-Crusader self-requested a review April 14, 2026 04:38
Copy link
Copy Markdown
Collaborator

@Codex-Crusader Codex-Crusader left a comment

Choose a reason for hiding this comment

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

All five points from my previous review have been addressed:

  • Checkbox ordering - st.sidebar.checkbox is now declared before it's read
  • Button reruns -st.rerun() restored on both "Load news feed" and "Load live data" buttons
  • Stale data UX - st.info is now paired with a "Refresh now" button so users can act on it
  • Epoch increment bug - all increments now consistently read from st.session_state instead of a stale local variable
  • Emoji in comments - removed

CI passes on py3.11 and py3.12. Nice work, merging.
Congratulations on your first merge :)

@Codex-Crusader Codex-Crusader merged commit 57de951 into The-Pulse-Engine:main Apr 14, 2026
3 checks passed
@Codex-Crusader
Copy link
Copy Markdown
Collaborator

Hope to see more of your contributions as we go!
Do star the repo.

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