Refactor frontend to hook-based architecture #33

Merged
ryan merged 1 commits from refactor/frontend-hooks into main 2026-04-24 09:12:48 -04:00
Owner

Summary

  • Extract logic from components into 6 custom hooks: useAuthCheck, useConversations, useChat, usePresignedUrl, useAdminUsers, useOIDCAuth
  • Eliminate unnecessary useEffects: scroll is now imperative, isAdmin piggybacks on existing getMe() call in useAuthCheck
  • ConversationList becomes a pure presentational component (no internal state/fetching)
  • Wrap QuestionBubble, AnswerBubble, ToolBubble in React.memo
  • Remove duplicate conversation fetches (ConversationList no longer fetches independently)
  • Only refresh conversations after creating a new one, not after every message

Test plan

  • yarn build passes (verified)
  • Load app: network tab shows 1x GET /api/user/me + 1x GET /api/conversation/ (no duplicates)
  • Send message: conversations not refetched unless new conversation created
  • Streaming still works, messages render correctly
  • OIDC login flow still works
  • Admin panel loads and edits work
  • Scroll-to-bottom works during streaming and after loading conversation
## Summary - Extract logic from components into 6 custom hooks: useAuthCheck, useConversations, useChat, usePresignedUrl, useAdminUsers, useOIDCAuth - Eliminate unnecessary useEffects: scroll is now imperative, isAdmin piggybacks on existing getMe() call in useAuthCheck - ConversationList becomes a pure presentational component (no internal state/fetching) - Wrap QuestionBubble, AnswerBubble, ToolBubble in React.memo - Remove duplicate conversation fetches (ConversationList no longer fetches independently) - Only refresh conversations after creating a new one, not after every message ## Test plan - [ ] yarn build passes (verified) - [ ] Load app: network tab shows 1x GET /api/user/me + 1x GET /api/conversation/ (no duplicates) - [ ] Send message: conversations not refetched unless new conversation created - [ ] Streaming still works, messages render correctly - [ ] OIDC login flow still works - [ ] Admin panel loads and edits work - [ ] Scroll-to-bottom works during streaming and after loading conversation
ryan added 1 commit 2026-04-24 09:12:28 -04:00
Extract logic from god components into custom hooks (useAuthCheck,
useConversations, useChat, usePresignedUrl, useAdminUsers, useOIDCAuth).
Eliminate unnecessary useEffects per React guidelines — scroll is now
imperative, isAdmin comes from useAuthCheck instead of a separate fetch.
ConversationList becomes a pure presentational component. Wrap bubble
components in React.memo.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ryan merged commit 8e884b5e76 into main 2026-04-24 09:12:48 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ryan/simbarag#33