Skip to content

Preserve UI data across sleep/hibernate resume#682

Merged
rygel merged 2 commits into
developfrom
fix/hibernate-data-preservation
Jun 28, 2026
Merged

Preserve UI data across sleep/hibernate resume#682
rygel merged 2 commits into
developfrom
fix/hibernate-data-preservation

Conversation

@rygel

@rygel rygel commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Problem

After hibernate/sleep, the UI showed zeros instead of keeping cached data. Users had to wait for fresh data while staring at an empty dashboard.

Root Cause

  1. OnPowerModeChanged(Resume) was a no-op — just logged, did nothing
  2. ApplyFetchedUsages blindly overwrote good cached data with all-unavailable/zero responses from the Monitor's post-resume refresh cycle

Fix

  1. Resume handler now triggers an immediate refresh + rapid polling (5s interval)
  2. ApplyFetchedUsages guards: if current data has available providers but incoming data is all unavailable, keep the old data and show 'reconnecting...' status

Two fixes for the post-hibernate data wipe:

1. OnPowerModeChanged now triggers a refresh and switches to rapid
   polling on resume, instead of just logging. The old code did
   nothing, leaving the timer to fire whenever it next ticked.

2. ApplyFetchedUsages guards against overwriting available data with
   all-unavailable data. After hibernate, the Monitor may serve
   zero-value entries while providers reconnect. The guard preserves
   the last known good data until at least one provider becomes
   available again, showing a 'reconnecting...' status instead.

Root cause: OnPowerModeChanged(PowerModes.Resume) was a no-op. The
polling timer would eventually fire, but the Monitor's refresh cycle
could return error/zero responses while the network was still
initializing, and ApplyFetchedUsages would blindly overwrite good
cached data with those zeros.
@rygel
rygel merged commit 5b55f5e into develop Jun 28, 2026
18 checks passed
@rygel
rygel deleted the fix/hibernate-data-preservation branch June 28, 2026 05:04
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