refactor(ui): isolate theme selector state - #864
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThe PR extracts theme resolution, committed selection, and transient previews into a dedicated controller while preserving theme identity across catalog reloads.
Confidence Score: 4/5The PR appears safe to merge after the non-blocking test-import convention issue is corrected. The theme-controller behavior is focused and well covered; the only accepted concern is the newly added dynamic import in the interaction test. Files Needing Attention: src/ui/AppHost.interactions.test.tsx Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
Bootstrap[Bootstrap theme inputs] --> Controller[Theme selector controller]
Catalog[Custom theme catalog] --> Controller
Controller --> Committed[Committed theme identity]
Controller --> Preview[Transient preview identity]
Committed --> Resolve[Resolve base theme]
Preview --> Resolve
Resolve --> Transparent{Transparent background?}
Transparent -->|Yes| Projection[Transparent surface projection]
Transparent -->|No| Active[Active theme]
Projection --> Active
Controller --> Selector[Theme selector dialog]
Committed --> Preferences[Persisted view preferences]
Committed --> Extensions[Extension theme event on acceptance]
Prompt To Fix All With AI### Issue 1
src/ui/AppHost.interactions.test.tsx:23
**Avoid dynamic test imports**
The newly added `await import("./App")` conflicts with the repository testing guideline requiring imports to be hoisted to the top level, making module initialization order less explicit; use a static top-level import instead.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "refactor(ui): isolate theme selector sta..." | Re-trigger Greptile |
| import { AGENT_SKILL_COMMAND, AGENT_SKILL_PROMPT } from "./components/chrome/AgentSkillDialog"; | ||
| import { resolveTheme } from "./themes"; | ||
| import { availableThemes, resolveTheme } from "./themes"; | ||
|
|
There was a problem hiding this comment.
The newly added await import("./App") conflicts with the repository testing guideline requiring imports to be hoisted to the top level, making module initialization order less explicit; use a static top-level import instead.
Context Used: testing.mdc Cursor rule (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/ui/AppHost.interactions.test.tsx
Line: 23
Comment:
**Avoid dynamic test imports**
The newly added `await import("./App")` conflicts with the repository testing guideline requiring imports to be hoisted to the top level, making module initialization order less explicit; use a static top-level import instead.
**Context Used:** testing.mdc Cursor rule ([source](https://github.com/modem-dev/modem/blob/main/.cursor/rules/testing.mdc))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
Testing
bun test src/ui/hooks/useThemeSelectorController.test.tsxbun test src/ui/AppHost.interactions.test.tsx --test-name-pattern 'theme|transparent background'bun run typecheckbun run deps:checkbun run test:theme-contrastbun run format:checkbun run lintThis PR description was generated by Pi using GPT-5.6 Sol