ui-react: twelve browser fixtures restore an absent theme as the literal "undefined"

Aperta Adatta ai principianti
#3,914 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
testing

Direzione di ricerca

Leggi i dodici callback di pulizia elencati nell’issue per i file indicati in packages/ui-react/tests/browser/. Controlla come i test vicini proteggono il ripristino quando il tema salvato è undefined, quindi aggiorna solo il codice di pulizia elencato. Conferma che i temi assenti restino assenti e che i valori presenti vengano ripristinati esattamente, quindi esegui ogni file modificato nel progetto browser assegnato.

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

Descrizione

agent-ready area: ui-react priority: p2 type: test

Context

Found during the #3855 test-health push (batch e3855-ui-react-04). Assigning a saved document.documentElement.dataset.theme back with dataset.theme = saved when the saved value was undefined writes the literal string "undefined" instead of removing the attribute. #2021 records the same fault for connection-replay.layout.tsx with a native Chromium observation ({before:null,after:"undefined"}). The ui-react-04 batch fixed seven instances in its own shard (review-dialogs, renderer-dispatch, tool-permission, search-results, supporting-files, sent-attachments, saved-transcription).

A grep at d19aec478 on that batch branch (dataset.theme = <saved value> with no undefined guard) finds these instances outside that shard:

  • afterEach, packages/ui-react/tests/browser/diagrams-renderer.layout.tsx:16
  • afterEach callback list, packages/ui-react/tests/browser/diagrams-callouts.layout.tsx:40
  • afterEach, packages/ui-react/tests/browser/diagrams-node-link.layout.tsx:12
  • afterEach, packages/ui-react/tests/browser/diagrams-frame.layout.tsx:22
  • afterEach, packages/ui-react/tests/browser/mermaid-content-renderer.layout.tsx:32
  • finally, packages/ui-react/tests/browser/error-boundaries.layout.tsx:225
  • ctx.onTestFinished, packages/ui-react/tests/browser/dictation-notice.pointer.tsx:133
  • ctx.onTestFinished, packages/ui-react/tests/browser/overlay-stacking.pointer.tsx:479

The guarded form already used across the suite is if (saved === undefined) delete document.documentElement.dataset.theme; else document.documentElement.dataset.theme = saved;.

Related: #2021 (the same fault in connection-replay.layout.tsx, kept there).

Scope

Restore an absent theme attribute as absent in the eight cleanups listed above, and in these four that triage found at 91e54be37 with the same unguarded restore of a saved dataset.theme (outside ui-react-04's seven, and not fixed on epic/3855-test-health when triaged):

  • afterEach, packages/ui-react/tests/browser/code-fences.layout.tsx:16
  • afterEach, packages/ui-react/tests/browser/code-fences-plain.layout.tsx:15
  • afterEach, packages/ui-react/tests/browser/inline-graph.layout.tsx:17
  • afterEach, packages/ui-react/tests/browser/draft-indicator.offline.tsx:65

If another #3855 batch fixes one of these first, leave it. Test code only.

Out of scope

  • connection-replay.layout.tsx. #2021 owns it.
  • diagrams-renderer.layout.tsx:110, which assigns a literal theme on purpose.
  • Any change to what these tests assert, to their theme matrices, or to product theme behaviour.

Acceptance criteria

  • Each listed cleanup leaves document.documentElement.hasAttribute("data-theme") false when the attribute was absent before the case, and restores the exact value when one was present.
  • A grep for unguarded dataset.theme = <saved value> assignments under packages/ui-react/tests and packages/ui-kit/tests returns only #2021's file (if it is still open) and the seven ui-react-04 sites, until #3919 reaches main through #3855.
  • Every touched file passes in its pinned browser project.

Verification

bun scripts/test-health.ts measure <file> --runs 2 for each touched file, or the file's bun run test:layout / bun run test:browser project. One native check that the attribute is absent after a case that started without it.

Contract impact

None. Test isolation only.

Triage 2026-11-10 (main 91e54be37): verified the eight cited sites against main (the dictation-notice restore moved to :133); added four more unguarded restores found by the same grep, so the grep criterion can actually pass; state-room.layout.tsx:49 restores previousTheme ?? "dark" on purpose and is not in scope.

Lingua principale
TypeScript
Stelle
4
Fork
0
Merge medio
6h 8m
PR unite (30g)
864

Preparare l'ambiente

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 schlessera/brain-kit

Tutte le issue di schlessera/brain-kit

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.