Skip to content

fix(desktop): user's wallpaper pick wins over theme default on login (#1603) - #1670

Merged
jaylfc merged 1 commit into
devfrom
fix/1603-user-wallpaper-wins-over-theme
Jul 6, 2026
Merged

fix(desktop): user's wallpaper pick wins over theme default on login (#1603)#1670
jaylfc merged 1 commit into
devfrom
fix/1603-user-wallpaper-wins-over-theme

Conversation

@jaylfc

@jaylfc jaylfc commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Addresses the wallpaper half of #1603.

Root cause

The desktop-settings persistence race that caused resets was already fixed (beta.24). The remaining "wallpaper always resets" symptom comes from a second restore path: restoreActiveTheme called applyThemeDefaultWallpaper(..., { restore: true }) on every boot, which re-applied the active theme's declared default wallpaper over the user's own pick. The user's chosen wallpaper is persisted separately (PUT /api/desktop/settings) and restored by useSessionPersistence, so for anyone on a non-default theme that declares a wallpaper, their pick was stomped on every login.

Fix

Stop applying the theme default on restore. The persisted wallpaper is authoritative, and a theme's default is already persisted when the theme is selected (so it still survives restore through that persisted value). Removed the now-dead restore branch of applyThemeDefaultWallpaper and its opts param.

This is a deliberate product decision (jaylfc): a user's explicit wallpaper choice should win over a theme's default. The previously-passing test that asserted the old override is updated to assert the pick wins.

Test

restore-theme.test.ts: user's persisted "ocean" survives restore of an Indigo theme declaring "neural-live". Theme-store suites: 20 passed.

Takes effect after an SPA rebuild (frontend change).

Summary by CodeRabbit

  • Bug Fixes
    • Restoring a theme now keeps your previously saved wallpaper instead of replacing it with the theme’s default.
    • Theme restoration still updates the active theme correctly, while respecting your personal wallpaper choice after startup.

…1603)

restoreActiveTheme re-applied the active theme's declared default wallpaper
on every boot, overriding a wallpaper the user had picked while on that theme
(the wallpaper is persisted separately and restored by useSessionPersistence).
That is the 'wallpaper always resets' report. Stop applying the theme default
on restore: the persisted pick is authoritative, and a theme's default is
already persisted when the theme is selected, so it still survives restore.
Drop the now-dead restore branch of applyThemeDefaultWallpaper and update the
test to assert the persisted pick wins.
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0d465086-9fde-4b18-b33f-d5ed1ebb0b78

📥 Commits

Reviewing files that changed from the base of the PR and between 5dea7c7 and dc28af7.

📒 Files selected for processing (2)
  • desktop/src/stores/__tests__/restore-theme.test.ts
  • desktop/src/stores/theme-store.ts

📝 Walkthrough

Walkthrough

The theme store's wallpaper resolution logic was refactored to always prioritize a remembered per-theme user choice over the theme's declared default wallpaper, removing the restore-specific branch. restoreActiveTheme no longer applies a default wallpaper, relying on session persistence to reapply the user's saved wallpaper. Tests were updated accordingly.

Changes

Theme Restore Wallpaper Fix

Layer / File(s) Summary
Wallpaper resolution and restore logic
desktop/src/stores/theme-store.ts
applyThemeDefaultWallpaper drops the restore flag and always resolves wallpaper by remembered per-theme choice, then theme default, then global default; restoreActiveTheme no longer applies a default wallpaper, deferring to useSessionPersistence.
Restore test updates
desktop/src/stores/__tests__/restore-theme.test.ts
Test mocks a theme with defaultWallpaperId, simulates a persisted user wallpaper, and asserts the persisted wallpaper is preserved (not overwritten) after restoreActiveTheme.

Estimated code review effort: 2 (Simple) | ~12 minutes

Sequence Diagram(s)

sequenceDiagram
  participant App
  participant useSessionPersistence
  participant restoreActiveTheme
  participant themeStore

  App->>useSessionPersistence: restore persisted wallpaper (ocean)
  App->>restoreActiveTheme: restore theme (indigo)
  restoreActiveTheme->>themeStore: set activeThemeId, themeDefaultWallpaper
  Note over restoreActiveTheme: skips applying theme default wallpaper
  useSessionPersistence->>themeStore: re-apply persisted wallpaper (ocean)
Loading

Possibly related PRs

  • jaylfc/taOS#927: Both PRs modify applyThemeDefaultWallpaper/restoreActiveTheme logic in theme-store.ts to prevent overwriting the user's persisted per-theme wallpaper.
  • jaylfc/taOS#1617: Both PRs coordinate the session theme/wallpaper restore path, affecting when and how restoreActiveTheme applies wallpaper state.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: preserving the user's wallpaper choice over the theme default during login restore.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1603-user-wallpaper-wins-over-theme

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kilo-code-bot

kilo-code-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The fix is small, targeted, and well-reasoned:

  • restoreActiveTheme no longer re-applies the active theme's declared defaultWallpaperId on boot, so a user's separately-persisted wallpaper choice (restored by useSessionPersistence) is no longer stomped.
  • The dead restore branch of applyThemeDefaultWallpaper and its opts parameter are removed, eliminating a code path that no caller needs.
  • The new test in restore-theme.test.ts directly asserts the user's persisted pick ("ocean") wins over Indigo's declared default ("neural-live") — exactly the regression in Desktop & Dock settings have no effect on the UI (beta.21) #1603.
  • The accompanying comment correctly documents the invariant (theme default survives restore only because it was already persisted when the user switched to the theme, which the auto-save useEffect in useSessionPersistence handles via wallpaperId change).
  • Cross-checked applyThemeDefaultWallpaper's remaining (keepTheme) path: it still writes wallpaperId directly, so useSessionPersistence's debounced save persists the theme's default on switch, preserving the claim in the new doc comment.
Files Reviewed (2 files)
  • desktop/src/stores/theme-store.ts
  • desktop/src/stores/__tests__/restore-theme.test.ts

Reviewed by minimax-m3 · Input: 34.4K · Output: 4.1K · Cached: 210.7K

@gitar-bot

gitar-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

@jaylfc
jaylfc merged commit 2d5a8c2 into dev Jul 6, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in TinyAgentOS Roadmap Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant