Refactor create-agent-dialog: extract hook and type select#737
Merged
Conversation
Split create-agent-dialog.tsx (760 → 357 lines) by extracting: - use-create-agent-form.ts (377 lines): all form state, effects, callbacks, and the submit handler - agent-type-select.tsx (119 lines): self-contained agent type dropdown combobox with its own open/close state The dialog component is now a thin render shell that delegates to the hook for logic and the AgentTypeSelect for the dropdown. Co-Authored-By: Claude Opus 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
use-create-agent-form.ts(377 lines) — all form state, effects, callbacks, and the submit handler moved into a custom hookagent-type-select.tsx(119 lines) — self-contained agent type dropdown combobox with its own open/close state managementcreate-agent-dialog.tsxreduced from 760 → 357 lines, now a thin render shellWhy this was a candidate
The create-agent dialog had 760 lines with 15+ useState hooks, 6 useEffect hooks, 9 useCallback handlers, and a complex submit handler — all mixed with a two-step form JSX. The hook extraction separates logic from presentation; the type select extracts a self-contained UI widget.
New file structure
Next run
The next componentizer run will tackle
feedback-panel.tsx(660 lines).Test plan
pnpm run finalize:web— type check + production build passpnpm run test:e2e— all 172 tests pass (12 terminal-live skipped as expected)🤖 Generated with Claude Code