Skip to content

Delete duplicated backend-form state; reuse a shared form hook #1338

@aivong-openhands

Description

@aivong-openhands

Follow-up from the Critical Carl review (CRITICAL_CARL_REVIEW.md, PR #1334).

Suggestion

Delete the duplicated backend-form state and reuse a single shared form hook.

Why this matters

src/components/features/backends/backend-form-modal.tsx declares the same name / host / apiKey / connectionError / isSubmitting state plus a handleSubmit twice — once in BackendForm (backend-form-modal.tsx:336-376) and again, near-identically, in ManualConnectionColumn (backend-form-modal.tsx:563-577). The duplicate drifts independently and doubles the surface to test.

This is a bounded "reuse instead of duplicate" subtraction (CARL: reuse third). It is intentionally scoped to the duplication only — the broader "this 877-line file is a controller" decomposition is left as documented structural debt in the review, not part of this issue.

Suggested scope

  • Extract one useBackendForm() hook holding the shared field/submit state.
  • Delete the duplicated state block + handleSubmit in ManualConnectionColumn and consume the hook instead.
  • Keep behavior identical (validation, connection test, submit); no UX change.
  • Add or update tests so both entry points exercise the shared hook.

Duplicate check

I searched the open agent-canvas issue set for "backend form" and related terms and did not find an equivalent open issue.

Related context

  • Critical Carl review: CRITICAL_CARL_REVIEW.md (PR WIP Add Critical Carl review report #1334)
  • This is the bounded, subtraction-shaped slice of review finding 6 (the open-ended controller decomposition is deliberately excluded per the issue-creation methodology).

This issue was created by an AI agent (OpenHands) on behalf of the user.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions