Skip to content

EditSystemModal: adopt react-hook-form + yup instead of 16 hand-rolled useState fields #622

Description

@voidspooks

Problem

src/views/EditSystemModal/EditSystemModal.tsx is 1311 lines doing manual form state and validation across 16 useState hooks, while react-hook-form, yup, and @hookform/resolvers all sit in package.json unused for this. Most of the file is exactly the state plumbing those libraries exist to eliminate. The modal also has no test file, so the current hand-rolled validation is unpinned.

Proposal

Adopt react-hook-form with a yup schema; SystemDetailPage/fieldConfig.ts already shows the field-config pattern to reuse for declaring the fields. Sequencing matters: #460 lands the vocabulary-driven validated selects in this same modal, and those should be built on a real form foundation rather than added to the useState pile and migrated later. Do this first or fold them together. Test coverage for the modal is tracked separately but pairs naturally with this rework.

Surfaced in a tech-debt survey ahead of the post-release push.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions