Skip to content

Fix: keep the wallpaper and the current page across a reload - #45

Merged
SandObserver merged 1 commit into
mainfrom
fix/wallpaper-page-reset
Aug 12, 2026
Merged

SandObserver merged 1 commit into
mainfrom
fix/wallpaper-page-reset

Conversation

@SandObserver

@SandObserver SandObserver commented Aug 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Cache the resolved Unsplash wallpaper URL in localStorage for 24 hours, keyed to the background type and collection, so a reload reuses the same photo instead of calling /api/wallpaper again.
  • Discard the cached entry when the background settings change, when the window has passed, or when the stored entry is unusable or stamped in the future.
  • Persist the current page index in localStorage and restore it on load, clamped to the pages that exist, for both the desktop and mobile builds.
  • Add an announce parameter to goTo so the page restored on load is not read out by the live region.

Testing
All green, apart from the Docker build smoke test, which needs a local Docker daemon. Added 8 tests for the wallpaper cache and the page restore, and 1 asserting the restored page is not announced.

Checklist

  • Stays within the project constraints: one container, no runtime dependencies, no build step (see CONTRIBUTING.md).
  • Tests added or updated for new logic, and the full suite, lint, and typechecks pass.
  • Docs updated if behavior or configuration changed.
  • CHANGELOG.md updated under Unreleased if the change is user-visible.

Every config save bumps _rev, which reloads every open dashboard. Each
reload asked Unsplash for a new random photo and reset the page index.

Cache the resolved wallpaper URL in localStorage for a day, keyed to the
background type and collection, and restore the page index on load.
@SandObserver SandObserver added the bug Something isn't working label Aug 12, 2026
@SandObserver
SandObserver merged commit 653bba8 into main Aug 12, 2026
4 checks passed
@SandObserver
SandObserver deleted the fix/wallpaper-page-reset branch August 12, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant