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

Aperta
#129 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@falbany ci sta già lavorando.

Dal 17/11/2026.

  • #184 di @falbany — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
67/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
Python
Stelle
1
Fork
1
Merge medio
4h 46m
PR unite (30g)
55

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di falbany/ProFiles

Tutte le issue di falbany/ProFiles

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.