Skip to documentation

Design system / Sources & standards

Current repository source

ADR-0084-submission-form-batch-editing.md

docs/decisions/ADR-0084-submission-form-batch-editing.md

This view contains the escaped source read during the deployment build. Code and policy text are unchanged. Markdown is shown as source, not rendered as a document. A new deployment refreshes the content.

# ADR-0084: Submission form batch editing

- **Status:** accepted
- **Date:** 2026-10-05
- **Supersedes (scoped):** ADR-0083's inline-editing interaction and active-field save/cancel requirement only. Title-only drafts, UI-only completeness, authorization and transactional attachment persistence remain unchanged.

## Context

Manual verification of PR #213 exposed three competing save concepts: individual field saves, attachment saves, and a Save Draft button that actually changed status. The editor does not share its presentation with the read-only submission view, so inline editing does not deliver an edit-in-place preview benefit.

## Options considered

1. Keep inline saves and rename the status action. Rejected: retains fragmented field/attachment persistence.
2. Save fields automatically on blur. Rejected: makes the persistence boundary implicit and does not make Save Draft meaningful.
3. Reuse the creation form for batch editing. Accepted.

## Decision

- `SubmissionForm` remains a submissions-owned organism shared by creation and editing. `EditSubmissionForm` and its Edition adapter are product instances; routes retain authorization and initial data loading. No domain behavior moves into `components/ui`.
- Ordinary inputs retain multiple edits locally. Save Draft persists current fields and the complete attachment set together; Submit persists the same snapshot with submitted status once current local values satisfy UI readiness. Pending uploads block both actions.
- For submitted entries, Save Changes preserves submitted status and Return to Draft explicitly changes it while saving current edits. There are no per-field or separate attachment save actions.
- Dirty tracking covers form values, attachment additions/removals/order and descriptions. Successful saves establish a new baseline; failed saves retain local values and attachment changes. Inputs, upload/drop/reorder controls and save actions are disabled during persistence.
- The status/readiness panel remains at the top of editing. Navigation confirmation protects Cancel and current-tab links, with native beforeunload protection for refresh/close/document exits and cancellable Navigation API traversal for browser Back/Forward where supported. Older browsers without that API retain link/document-exit protection but cannot cancel same-document history traversal.
- `useSubmissionForm` owns form/attachment coordination and `useSubmissionUnsavedChanges` owns navigation subscriptions. `useEditSubmission` owns mutation lifecycle and persisted status; no Context or global store is introduced.

## Rationale

A single explicit persistence boundary makes Save Draft match its label, permits several edits at once, and reuses the existing transactional API without schema or trust-boundary changes.

## Consequences

- Creation and editing share field markup, configured field visibility and readiness behavior.
- Uploading an asset still precedes linking it to a submission; leaving without saving may leave an unlinked asset, as before.
- Focused component/hook tests cover dirty baselines, batch requests, submitted status, attachment changes and retry. Browser coverage verifies reload persistence, navigation rejection and mobile layout.
All sources and standards
Current components and theme tokens. Fictional example data. Source views refresh on deployment; authors maintain contract notes.