Skip to content

fix(web): show a clear message on Compare when no tariffs are configured - #4355

Merged
springfall2008 merged 2 commits into
springfall2008:mainfrom
chalfontchubby:fix/compare-entities-empty-state
Jul 29, 2026
Merged

fix(web): show a clear message on Compare when no tariffs are configured#4355
springfall2008 merged 2 commits into
springfall2008:mainfrom
chalfontchubby:fix/compare-entities-empty-state

Conversation

@chalfontchubby

Copy link
Copy Markdown
Collaborator

Summary

  • Follows on from Frontend routing broken #4334 - a user reported the Compare page as "broken/empty," which turned out to be an empty compare_list in apps.yaml (no tariffs configured), not a routing bug. But the page's actual behaviour in that state was genuinely misleading: it showed "Loading chart (please wait)..." and "7 day rolling average chart loading (please wait)..." forever, since nothing was ever going to load without a compare_list entry - indistinguishable from an actually broken page.
  • Now checks compare_list directly: if it's empty, shows a message pointing at the Compare Energy Tariff docs instead. If compare_list is set but the comparison hasn't run/computed yet, keeps the original "please wait" message, since that's a genuine loading state.
  • Entities page wasn't touched - its existing "No entities selected" empty state is already clear and correctly worded, this was Compare-specific.

Test plan

  • New tests in test_web_functions.py covering both branches (empty compare_list shows the new message and not the stuck loading text; a configured-but-not-yet-computed compare_list keeps the genuine loading message)
  • ./run_all --test web_functions --test compare --test web_charts - all pass
  • pre-commit (ruff, black, cspell) run against the changed files, passed

🤖 Generated with Claude Code

An empty compare_list rendered "Loading chart (please wait)..." forever,
since nothing was ever going to load - indistinguishable from a genuinely
broken page. Now shows a direct pointer to the Compare docs instead, and
keeps the real "please wait" message for the case where tariffs are
configured but the comparison hasn't run yet. Fixes springfall2008#4334.

Copilot AI 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.

Pull request overview

This pull request improves the Compare page in the Predbat web UI by distinguishing a genuine “still computing” state from a “nothing configured” state, addressing reports of the page appearing broken when compare_list is empty.

Changes:

  • Add an explicit empty-state message on the Compare page when compare_list is not configured, linking users to the Compare docs.
  • Preserve the existing “Loading chart (please wait)…” messaging when tariffs are configured but comparison data hasn’t been computed yet.
  • Add unit tests covering both the empty compare_list branch and the configured-but-not-yet-computed branch.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
apps/predbat/web.py Adds Compare-page empty-state handling and suppresses misleading “loading forever” messaging when compare_list is empty.
apps/predbat/tests/test_web_functions.py Adds regression tests for Compare empty-state messaging to prevent reintroducing the misleading UI state.

Comment thread apps/predbat/web.py Outdated
…d anchor text

target="_blank" without rel="noopener noreferrer" is a reverse-tabnabbing
risk, and the anchor text didn't match the actual docs page title
("Comparing Energy Tariffs", not "Compare Energy Tariff").
@springfall2008
springfall2008 merged commit 10170f5 into springfall2008:main Jul 29, 2026
2 checks passed
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.

3 participants