refactor(ui): isolate view preference quit flow - #863
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThe PR extracts view-preference dirty tracking, persistence, prompting, and delayed shutdown from App into a dedicated controller hook while preserving the mounted baseline across soft reloads.
Confidence Score: 4/5The PR appears safe to merge, with one non-blocking environment-access convention issue in the new controller. The refactored flow preserves the existing prompt and persistence behavior, but the new reusable hook directly reads HOME from process.env instead of using the repository's validated environment boundary. Files Needing Attention: src/ui/hooks/useViewPreferenceQuitController.ts Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
Q[Quit requested] --> D{Persistent view preferences changed?}
D -->|No or prompting disabled| X[Quit immediately]
D -->|Yes| P[Open save prompt]
P -->|Save| S[Persist preferences]
P -->|Never ask| N[Persist prompt policy]
P -->|Discard| X
P -->|Cancel| R[Return to review]
S --> L[Close and lock prompt actions]
N --> L
L --> T[Show notice and schedule delayed quit]
T --> X
Prompt To Fix All With AI### Issue 1
src/ui/hooks/useViewPreferenceQuitController.ts:84
**Direct environment access**
The new reusable controller reads `HOME` directly from `process.env` whenever App omits `homeDirectory`, bypassing the repository's type-safe, validated environment-variable boundary and establishing an unsupported environment-access path.
---
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 view preference qu..." | Re-trigger Greptile |
Summary
Appinto a focused controller hookTesting
bun test src/ui/hooks/useViewPreferenceQuitController.test.tsxbun test src/ui/AppHost.interactions.test.tsxbun run typecheckbun run deps:checkbun run format:checkbun run lintThis PR description was generated by Pi using GPT-5.6 Sol