Skip to content

refactor(site): separate AgentsPage and AgentDetail into container/view pairs - #22812

Merged
DanielleMaywood merged 12 commits into
mainfrom
agents-fix-issue-1
Mar 10, 2026
Merged

DanielleMaywood merged 12 commits into
mainfrom
agents-fix-issue-1

Conversation

@DanielleMaywood

@DanielleMaywood DanielleMaywood commented Mar 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Splits the two largest AgentsPage files into container/view pairs following the established project convention (e.g. WorkspacesPage/WorkspacesPageView, UsersPage/UsersPageView), then simplifies the resulting View components.

Changes

Container/View split

  • AgentsPage.tsx → container (AgentsPage.tsx) + view (AgentsPageView.tsx)
  • AgentDetail.tsx → container (AgentDetail.tsx) + view (AgentDetailView.tsx)

Containers handle data fetching, mutations, and routing. Views are presentational components that receive data as props.

View simplification

AgentsPageView (18 → 14 props):

  • Removed duplicated props already available via outletContext.
  • Replaced emptyStateNode: ReactNode render prop — View now renders AgentCreateForm directly from data props.
  • Replaced toolbarEndContent: ReactNode render prop with isAgentsAdmin flag — View owns the Admin button.
  • Dialog state (isConfigureAgentsDialogOpen) moved into the View since both consumers (toolbar button, create form) are now rendered there.

AgentDetailView (53 → 43 props):

  • Removed AgentDetailTimeline and AgentDetailInput component props — View imports them directly.
  • Internalized UI-only panel state (showSidebarPanel, isRightPanelExpanded, dragVisualExpanded) as useState inside the View.
  • Derives hasDiffStatus and hasGitRepos from data the View already receives.
  • Moved auto-open sidebar logic into the View.

AgentDetail container:

  • Typed useOutletContext as non-optional (always rendered as child route of AgentsPage) — eliminated 5 module-level noop fallback constants and all ?? defensive access.
  • Inline destructuring of outlet context.

Other fixes

  • chatsLoadError prop type changed from Error | undefined to Error | null to match TanStack Query convention, removing a redundant ternary.
  • Restored Tailwind [&_[cmdk-item]] underscore escape that was broken by auto-format (underscore is Tailwind's space escape in arbitrary selectors).
  • Renamed AgentsEmptyState → AgentCreateForm (it's a full chat creation form, not an empty state placeholder).

Storybook

  • Added stories for AgentDetailView (loaded, loading, not-found states).
  • Added stories for AgentsPageView.
  • Renamed AgentsEmptyState.stories.tsx → AgentCreateForm.stories.tsx.

All existing named exports remain importable from their original paths.

@DanielleMaywood
DanielleMaywood force-pushed the agents-fix-issue-1 branch 7 times, most recently from 0ea30e0 to f157470 Compare March 9, 2026 22:24
@DanielleMaywood
DanielleMaywood marked this pull request as ready for review March 9, 2026 22:36
…ew pairs

Splits the two largest AgentsPage files into container/view pairs following
the established project convention (e.g. WorkspacesPage/WorkspacesPageView).

- AgentsPage.tsx → container (AgentsPage.tsx) + view (AgentsPageView.tsx)
- AgentDetail.tsx → container (AgentDetail.tsx) + view (AgentDetailView.tsx)

Containers handle data fetching, hooks, state, and error/loading guards.
Views are pure rendering components that receive all data as props.

All existing named exports remain importable from their original paths.
Add full coverage stories for AgentDetailView, AgentDetailLoadingView,
and AgentDetailNotFoundView. Export AgentDetailTimeline and
AgentDetailInput from AgentDetail.tsx so stories use the real
components instead of stubs.
…nd internalizing UI state

- AgentsPageView: remove 4 props duplicated between direct props and
  outletContext (chatErrorReasons, requestArchiveAgent,
  requestUnarchiveAgent, requestArchiveAndDeleteWorkspace); View now
  destructures them from outletContext.
- AgentDetailView: move 6 panel/sidebar UI state props into the View
  as local useState (showSidebarPanel, isRightPanelExpanded,
  dragVisualExpanded and their setters); derive hasDiffStatus and
  hasGitRepos from existing props instead of receiving them.
- Move auto-open sidebar logic into the View alongside the state it
  mutates.
- Update stories to match reduced prop interfaces.
@DanielleMaywood
DanielleMaywood merged commit d61772d into main Mar 10, 2026
22 of 25 checks passed
@DanielleMaywood
DanielleMaywood deleted the agents-fix-issue-1 branch March 10, 2026 12:09
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants