fix(web): show a clear message on Compare when no tariffs are configured - #4355
Merged
springfall2008 merged 2 commits intoJul 29, 2026
Merged
Conversation
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.
Contributor
There was a problem hiding this comment.
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_listis 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_listbranch 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. |
…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").
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
compare_listinapps.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 acompare_listentry - indistinguishable from an actually broken page.compare_listdirectly: if it's empty, shows a message pointing at the Compare Energy Tariff docs instead. Ifcompare_listis set but the comparison hasn't run/computed yet, keeps the original "please wait" message, since that's a genuine loading state.Test plan
test_web_functions.pycovering both branches (emptycompare_listshows the new message and not the stuck loading text; a configured-but-not-yet-computedcompare_listkeeps the genuine loading message)./run_all --test web_functions --test compare --test web_charts- all passpre-commit(ruff, black, cspell) run against the changed files, passed🤖 Generated with Claude Code