From 3a0c45a0b2f1e749c9fcd2edf795feb850b46133 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Almeida?= Date: Tue, 12 May 2026 23:59:53 +0100 Subject: [PATCH] fix(web): extract buildDialog{FormBody,Footer}Props to satisfy lint cap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the main merge, prettier expanded my hand-compacted destructuring in TaskCreateDialog onto multiple lines, putting the function at 115 lines (over the 100 cap). Extract the two prop-assembly blocks into buildDialogFormBodyProps + buildDialogFooterProps helper functions so the orchestrator becomes a thin JSX wrapper. No behaviour change — the helpers project the same shape, 1:1. Also fixes the upstream CI failure: prettier --check was rejecting the hand-compacted destructuring lines. --- apps/web/components/task-create-dialog.tsx | 177 +++++++++++---------- 1 file changed, 96 insertions(+), 81 deletions(-) diff --git a/apps/web/components/task-create-dialog.tsx b/apps/web/components/task-create-dialog.tsx index be5a13bba6..19eab08017 100644 --- a/apps/web/components/task-create-dialog.tsx +++ b/apps/web/components/task-create-dialog.tsx @@ -475,99 +475,114 @@ function useGuardedSubmit( ); } +// Build the props object passed to DialogFormBody. Extracted from +// TaskCreateDialog so the orchestrator stays under the 100-line cap; the +// shape just spreads setup + dialog props 1:1 so there's no behaviour change. +function buildDialogFormBodyProps( + setup: ReturnType, + props: TaskCreateDialogProps, +): DialogFormBodyProps { + const { fs, computed, handlers } = setup; + const repoLocked = !!props.lockedFields?.repository; + return { + isSessionMode: setup.isSessionMode, + isCreateMode: setup.isCreateMode, + isEditMode: setup.isEditMode, + isTaskStarted: setup.isTaskStarted, + onTaskNameChange: handlers.handleTaskNameChange, + onRowRepositoryChange: handlers.handleRowRepositoryChange, + onRowBranchChange: handlers.handleRowBranchChange, + isPassthroughProfile: computed.isPassthroughProfile, + initialDescription: fs.currentDefaults.description, + hasDescription: fs.hasDescription, + workspaceId: props.workspaceId, + onJiraImport: setup.handleJiraImport, + onLinearImport: setup.handleLinearImport, + agentProfileOptions: computed.agentProfileOptions, + executorProfileOptions: computed.executorProfileOptions, + agentProfiles: setup.agentProfiles, + agentProfilesLoading: computed.agentProfilesLoading, + executorsLoading: computed.executorsLoading, + isCreatingSession: fs.isCreatingSession, + workflows: setup.workflows, + snapshots: setup.snapshots, + effectiveWorkflowId: computed.effectiveWorkflowId ?? null, + fs, + handleKeyDown: setup.handleKeyDown, + onAgentProfileChange: handlers.handleAgentProfileChange, + onExecutorProfileChange: handlers.handleExecutorProfileChange, + onWorkflowChange: handlers.handleWorkflowChange, + onToggleGitHubUrl: repoLocked ? undefined : handlers.handleToggleGitHubUrl, + onGitHubUrlChange: handlers.handleGitHubUrlChange, + onToggleFreshBranch: handlers.handleToggleFreshBranch, + onToggleNoRepository: repoLocked ? undefined : handlers.handleToggleNoRepository, + onWorkspacePathChange: handlers.handleWorkspacePathChange, + enhance: setup.enhance, + workflowAgentLocked: computed.workflowAgentLocked, + repositories: setup.repositories, + freshBranchAvailable: setup.freshBranchAvailable, + isLocalExecutor: computed.isLocalExecutor, + noCompatibleAgent: computed.noCompatibleAgent, + executorProfileName: computed.selectedExecutorProfileName, + extraFormSlot: props.extraFormSlot, + aboveDescriptionSlot: props.aboveDescriptionSlot, + bottomSlot: props.bottomSlot, + descriptionPlaceholder: props.descriptionPlaceholder, + workflowLocked: props.lockedFields?.workflow, + }; +} + +function buildDialogFooterProps( + setup: ReturnType, + props: TaskCreateDialogProps, +) { + const { fs, computed, submitHandlers } = setup; + return { + isSessionMode: setup.isSessionMode, + isCreateMode: setup.isCreateMode, + isEditMode: setup.isEditMode, + isTaskStarted: setup.isTaskStarted, + isPassthroughProfile: computed.isPassthroughProfile, + isCreatingSession: fs.isCreatingSession, + isCreatingTask: fs.isCreatingTask, + hasTitle: fs.hasTitle, + hasDescription: fs.hasDescription, + hasRepositorySelection: computed.hasRepositorySelection, + hasAllBranches: computeHasAllBranches(fs), + agentProfileId: computed.effectiveAgentProfileId, + workspaceId: props.workspaceId, + effectiveWorkflowId: computed.effectiveWorkflowId ?? null, + executorHint: computed.executorHint, + noCompatibleAgent: computed.noCompatibleAgent, + executorProfileName: computed.selectedExecutorProfileName, + onCancel: submitHandlers.handleCancel, + onUpdateWithoutAgent: submitHandlers.handleUpdateWithoutAgent, + onCreateWithoutAgent: submitHandlers.handleCreateWithoutAgent, + onCreateWithPlanMode: submitHandlers.handleCreateWithPlanMode, + submitBlockedReason: props.submitBlockedReason, + }; +} + export function TaskCreateDialog(props: TaskCreateDialogProps) { - const { open, onOpenChange, initialValues, workspaceId } = props; const setup = useTaskCreateDialogSetup(props); - const { fs, isSessionMode, isEditMode, isCreateMode, isTaskStarted, sessionRepoName } = setup; - const { workflows, agentProfiles, snapshots, repositories, computed, handlers } = setup; - const { handleKeyDown, freshBranchAvailable, handleJiraImport, handleLinearImport, guardedHandleSubmit } = setup; - const { handleUpdateWithoutAgent, handleCreateWithoutAgent, handleCreateWithPlanMode, handleCancel } = setup.submitHandlers; return ( - + -
- + + - +