Skip to content

[Refactor]: Split large frontend catalog pages into composable pieces #480

Open

Description

@tomvothecoder

Is your feature request related to a problem?

Three catalog components in frontend/src/features/catalog/ hold page layout, form state, validation mapping, URL state, and many small sub-components in one file:

File Lines Mixed concerns
components/ExecutionDetailsView.tsx ~1,740 Read-only field components, artifact and link editing (EditableResourceList), validation error mapping (mapSaveValidationErrors, toValidationPathLabel), form state and update payload building
CaseDetailsPage.tsx ~1,580 Resource grouping and labels, form state and update payload building, save error handling (getUpdateError)
CasesPage.tsx ~1,240 URL search-param parsing and serialization (parseCaseSearchState, serializeCaseSearchState), sorting and paging constants, table rendering

Duplication:

  • mergeRowFieldErrors is defined identically in ExecutionDetailsView.tsx and CaseDetailsPage.tsx.
  • Both detail views define their own toEditableFormState, normalizeEditableValue, and buildUpdatePayload with the same shape.
  • ExecutionDetailsView.tsx defines EditableResourceList inline, next to the existing components/EditableExternalLinkList.tsx.

Related: #306 (backend counterpart).

Describe the solution you'd like

Extract pieces into features/catalog/ without changing behavior.

  • components/: move reusable sub-components out of ExecutionDetailsView.tsx (FieldRow, ReadonlyInput, ReadonlyText, UserDisplay, ExternalResource*, EditableResourceList).
  • Utility module (for example, resourceEditing.ts, alongside externalLinkEditing.ts): shared row-error helpers (mergeRowFieldErrors, hasAnyRowErrors) and validation error mapping.
  • hooks/: a hook for CasesPage URL search state (for example, useCaseSearchParams) that wraps the parse and serialize functions.
  • Keep page files focused on layout and data wiring.

Follow the existing layer rules in frontend/README.md and eslint-plugin-boundaries. Code stays inside features/catalog/ unless it is truly reusable across features, in which case it goes in components/shared/.

Acceptance criteria

  • mergeRowFieldErrors and the other duplicated helpers have one definition each.
  • Each of the three files is substantially smaller and contains mainly page or view composition.
  • No UI or behavior change: the catalog pages render and edit as before.
  • make frontend-lint and make pre-commit-run pass.

Describe alternatives you've considered

  • One generic detail-editing form shared by cases and executions. The fields and payloads differ enough that this would add abstraction too early. Share helpers first.

Additional context

Other large frontend files, possible follow-ups: features/diagnostics/ComparePage.tsx (~860 lines), features/diagnostics/components/RunEditor.tsx (~850), and features/upload/UploadPage.tsx (~750).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorRefactor existing code

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions