Skip to content

Refactor AppHost into its own module#140

Merged
benvinegar merged 2 commits intomainfrom
refactor/split-apphost
Mar 30, 2026
Merged

Refactor AppHost into its own module#140
benvinegar merged 2 commits intomainfrom
refactor/split-apphost

Conversation

@benvinegar
Copy link
Copy Markdown
Member

Summary

  • move AppHost out of src/ui/App.tsx into src/ui/AppHost.tsx
  • keep App.tsx focused on interactive app orchestration and re-export AppHost for compatibility
  • add comments explaining the non-obvious reloadSession normalization/re-registration flow

Testing

  • bun run typecheck
  • bun test test/app-interactions.test.tsx test/app-responsive.test.tsx test/ui-components.test.tsx test/ui-scroll-regression.test.tsx test/vertical-scrollbar.test.tsx

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 30, 2026

Greptile Summary

This PR extracts the AppHost component from src/ui/App.tsx into its own src/ui/AppHost.tsx module, keeping App.tsx focused on interactive app orchestration. A re-export of AppHost is retained in App.tsx for backward compatibility (test files still import via ../src/ui/App), and the App component is now exported so AppHost.tsx can import it directly.

Key changes:

  • src/ui/AppHost.tsx — new file with the moved AppHost component; well-commented reloadSession callback explains the normalization pipeline and daemon session re-registration flow
  • src/ui/App.tsxAppHost implementation replaced with a re-export from ./AppHost; App function is now a named export
  • src/main.tsx, benchmarks/highlight-prefetch.ts, benchmarks/large-stream.ts — imports updated to point directly to ./ui/AppHost
  • The re-export in App.tsx introduces a circular module dependency (App.tsxAppHost.tsxApp.tsx), which is safe at runtime with ES module live bindings but is worth tracking as a code smell

Confidence Score: 5/5

Safe to merge — this is a clean module refactor with no behavioral changes.

All findings are P2 style observations. The only notable concern is the circular dependency introduced by the App.tsx re-export, but it is functionally safe with ES module live bindings and is necessitated by backward compatibility with test files. No logic was changed.

No files require special attention beyond the circular dependency note on src/ui/App.tsx.

Important Files Changed

Filename Overview
src/ui/AppHost.tsx New file — AppHost component moved verbatim from App.tsx with helpful inline comments added to the reloadSession callback explaining the normalization pipeline and daemon re-registration.
src/ui/App.tsx AppHost removed and re-exported from ./AppHost; App function now exported. Introduces a circular dependency between App.tsx and AppHost.tsx that works safely at runtime but is a code smell.
src/main.tsx Import of AppHost updated to point directly to the new ./ui/AppHost module — clean and correct.
benchmarks/highlight-prefetch.ts Import updated from ../src/ui/App to ../src/ui/AppHost — no other changes.
benchmarks/large-stream.ts Import updated from ../src/ui/App to ../src/ui/AppHost — no other changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    main["src/main.tsx"]
    bench1["benchmarks/highlight-prefetch.ts"]
    bench2["benchmarks/large-stream.ts"]
    tests["test/*.test.tsx\n(unchanged)"]

    AppHost_file["src/ui/AppHost.tsx\nAppHost component"]
    App_file["src/ui/App.tsx\nApp component\n+ re-export AppHost"]

    main -->|"import AppHost"| AppHost_file
    bench1 -->|"import AppHost"| AppHost_file
    bench2 -->|"import AppHost"| AppHost_file
    tests -->|"import AppHost\n(compat re-export)"| App_file

    App_file -->|"export { AppHost }"| AppHost_file
    AppHost_file -->|"import { App }"| App_file

    style App_file stroke:#f90,stroke-width:2px
    style AppHost_file stroke:#0a0,stroke-width:2px
Loading

Reviews (1): Last reviewed commit: "Refactor AppHost out of App" | Re-trigger Greptile

@benvinegar benvinegar merged commit fa557d2 into main Mar 30, 2026
3 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