M007 S01: OpeningList Edit button opens blank editor — never passes existing opening data #10

Closed
opened 2026-05-15 19:21:18 +00:00 by Mark · 1 comment
Owner

Severity: HIGH
File: src/components/OpeningList.tsx:179-180

Problem

Clicking "Edit" on an expanded opening card calls setShowEditor(true) which renders <OpeningEditor> inside OpeningList, but never passes the existing prop — the editor always shows a blank form even when editing an existing opening.

Line 179-180:

<SecondaryButton onClick={() => setShowEditor(true)}>
  Edit
</SecondaryButton>

Fix

OpeningList needs to track which opening is being edited and pass it:

const [editingOpening, setEditingOpening] = useState<Opening | null>(null);
// ...
<SecondaryButton onClick={() => setEditingOpening(op)}>Edit</SecondaryButton>
{/* render */}
<OpeningEditor existing={editingOpening} ... />
**Severity:** HIGH **File:** src/components/OpeningList.tsx:179-180 ## Problem Clicking "Edit" on an expanded opening card calls `setShowEditor(true)` which renders `<OpeningEditor>` inside OpeningList, but never passes the `existing` prop — the editor always shows a blank form even when editing an existing opening. Line 179-180: ```tsx <SecondaryButton onClick={() => setShowEditor(true)}> Edit </SecondaryButton> ``` ## Fix OpeningList needs to track which opening is being edited and pass it: ```tsx const [editingOpening, setEditingOpening] = useState<Opening | null>(null); // ... <SecondaryButton onClick={() => setEditingOpening(op)}>Edit</SecondaryButton> {/* render */} <OpeningEditor existing={editingOpening} ... /> ```
Author
Owner

Unblocking — lint gate now passes clean (47dfc01).

Unblocking — lint gate now passes clean (47dfc01).
Mark closed this issue 2026-05-16 17:23:30 +00:00
Sign in to join this conversation.
No description provided.