Web UI: theme preference is persisted but never restored; session-trial theme leaks into localStorage

Open
#129 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@falbany is already working on this.

Since Nov 17, 2026.

  • #184 by @falbany — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
67/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
react, typescript
Domain
frontend

Research direction

Start in web/src/App.tsx at the theme state initializer, initializeFromConfig, handleConfigLoaded, and the persistence effect; also read utils/theme.ts for how auto is resolved. Check the existing theme-related tests or add coverage for restoring a saved preference and preventing a session-trial theme from being saved. Done when the saved theme is restored, config themes still override it, and trial themes do not leak into localStorage.

Written by the indexing model from the issue text.

Description

bug frontend

Problem

localStorage.setItem("profiles-theme", …) is written in two places (App.tsx:564, App.tsx:1450), but a full grep of web/src, index.html and the desktop shell finds zero getItem("profiles-theme") reads; initial state is hardcoded useState<"dark" | "light">("dark") (line 66). The persistence is dead — theme resets to dark every session.

Additionally, handleConfigLoaded's comment (App.tsx:377-380) promises a dropped/session-trial config's theme "must NOT persist… that would leak the trial into the next session" — but setTheme(...) from the trial fires the persistence effect (App.tsx:1447-1454), which writes the trial theme to localStorage anyway. Today that's harmless only because nothing reads it; the moment someone implements the read side, the leak activates.

Suggested fix

  1. Initialize theme from localStorage.getItem("profiles-theme") in the useState initializer.
  2. Track theme provenance in a ref; skip the write when the theme came from a session-trial config.
  3. Keep config-file theme as the override in initializeFromConfig.
  4. While in there: consider honoring theme: auto via matchMedia("(prefers-color-scheme: light)") — resolveSessionTheme (utils/theme.ts:6-8) currently flattens auto to dark.
Dominant language
Python
Stars
1
Forks
1
Avg merge
4h 46m
Merged PRs (30d)
55

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from falbany/ProFiles

All issues in falbany/ProFiles

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.