Skip to content

fix(ui): persist themes across routed surfaces - #1040

Merged
benvinegar merged 1 commit into
mainfrom
fix/persist-theme-across-surfaces
Sep 7, 2026
Merged

benvinegar merged 1 commit into
mainfrom
fix/persist-theme-across-surfaces

Conversation

@benvinegar

@benvinegar benvinegar commented Sep 7, 2026 •

Copy link
Copy Markdown
Member

Problem

Changing the theme inside a commit review launched from history was lost when returning to the history surface. History and review each owned separate committed theme state, so only history-to-review navigation carried the active choice.

Approach

  • add a session-scoped ThemeController owned by HunkSessionHost
  • subscribe history and review selectors to the same committed theme identity while keeping modal previews surface-local
  • remove the duplicate theme state from LogController
  • retain the session launch theme as the save-preferences baseline across route remounts
  • cover history-to-review-to-history navigation and repeated review launches

This belongs in core UI routing because theme selection is shared application chrome state for every routed surface, not extension-specific behavior.

Validation

  • bun run typecheck
  • bun run format:check
  • bun run lint
  • bun run deps:check
  • TMPDIR=/var/tmp bun run test (4,084 passed, 12 skipped)
  • bun run test:integration (157 passed, 1 skipped)
  • bun run test:tty-smoke (9 passed)
  • bun run install:bin
  • real TTY render of hunk diff --no-extensions against the working-tree diff
  • manually changed themes across history and repeated review navigation on Linux

Visual Evidence

No visual styling changes. The existing selector and themes render unchanged; this PR changes their state lifetime across route transitions.

@vercel

vercel Bot commented Sep 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
hunk-web Ignored Ignored Sep 7, 2026 9:31pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR moves committed theme ownership from individual history and review surfaces into a session-scoped controller.

  • Shares committed theme changes across history-to-review route transitions and repeated review launches.
  • Keeps selector previews local to each mounted surface.
  • Preserves the session launch theme as the quit-time preference baseline.
  • Removes duplicate theme state from LogController and adds regression coverage for controller publication and routed persistence.

Confidence Score: 5/5

The PR appears safe to merge, with routed theme ownership and preference-baseline behavior covered by focused regression tests.

No actionable correctness, security, or repository-rule violations remain; the shared controller preserves launch-scoped theme detection and uses the same theme catalog across the normal history-to-review flow.

Important Files Changed

Filename Overview
packages/hunk/src/ui/theme/controller.ts Introduces a small session-scoped external store for the resolved launch theme and subsequent committed identities.
packages/hunk/src/ui/hooks/useThemeSelectorController.ts Replaces surface-local committed theme state with a subscription to the shared controller while retaining local modal preview state.
packages/hunk/src/ui/session/HunkSessionHost.tsx Owns one theme controller across routed history and review surfaces and forwards its current theme when preparing reviews.
packages/hunk/src/ui/log/LogApp.tsx Uses the shared theme controller and removes theme details from the route outcome contract.
packages/hunk/src/ui/App.tsx Consumes an injected session theme controller with a standalone fallback and uses its launch identity as the preference baseline.
packages/hunk/src/ui/session/HunkSessionHost.test.tsx Covers theme persistence through history, repeated review launches, return navigation, and preference prompting.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    Session[HunkSessionHost] --> Controller[ThemeController]
    Controller --> History[LogApp theme selector]
    Controller --> Review[AppHost / App theme selector]
    History -->|commitTheme| Controller
    Review -->|commitTheme| Controller
    Controller -->|external-store snapshot| History
    Controller -->|external-store snapshot| Review
    History -->|launch review with current theme| ReviewRoute[Embedded review route]
    ReviewRoute -->|quit| History
Loading

Reviews (1): Last reviewed commit: "fix(ui): persist themes across routed su..." | Re-trigger Greptile

@benvinegar
benvinegar enabled auto-merge (squash) September 7, 2026 21:38
@benvinegar
benvinegar merged commit f9ef7ce into main Sep 7, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant