Editor stitch type "Cross Stitch" dropdown (value "cross") silently maps to Satin on export — lookup table uses "cross-stitch" with hyphen, find() returns undefined #139

Closed
opened 2026-10-03 04:07:30 +00:00 by Mark · 1 comment
Owner

Finding

The Editor's Stitch Type dropdown offers 5 values: satin, fill, running, cross, zigzag. The Editor's path-to-stitch-object mapper at src/pages/Editor.tsx:113-114 looks for matches in the list ['satin', 'fill', 'running', 'cross-stitch', 'motif', 'zigzag'].

The dropdown value cross does not match the lookup value cross-stitch (with a hyphen). When a user picks "Cross Stitch" in the editor and exports, the find() returns undefined and the type silently falls back to satin.

zigzag works because the lookup table includes it. cross does not.

Where

  • Dropdown: src/components/editor/EditorRightPanel.tsx:294-298 (<option value="cross">Cross Stitch</option>)
  • Lookup: src/pages/Editor.tsx:113-114 (['satin', 'fill', 'running', 'cross-stitch', 'motif', 'zigzag'])
  • Editor stitch type state: src/components/editor/types.ts

Suggested fix shape

Two options:

  1. Rename the dropdown value to cross-stitch (and add motif to the dropdown while at it). This aligns the editor dropdown with the lookup table.
  2. Normalize both sides in the editor's path-to-stitch mapper: strip hyphens and lowercase before comparison, so cross matches cross-stitch. Simpler, less code change.

Option 1 is the explicit fix; option 2 is the defensive fix that prevents future drift. Either is fine.

Also: the lookup table has motif but the editor dropdown doesn't offer it. The Help page (in #109-era text) doesn't mention motif either. Decide whether motif is a real stitch type the user should be able to select, or remove it from the lookup.

Severity

Medium. A user picks Cross Stitch expecting a cross-stitch export, gets satin instead. Silent behavior; no error or warning.

Discovered by

Gap analysis (2026-10-02) of editor stitch type handling.

  • #130 (closed) — service returns 5 stitch types, editor exposes 3. The dropdown has been partially extended since then; this issue covers the remaining dropdown/lookup mismatch.
  • #109 (closed) — Help page "Steil Stitch" typo. Same family of stitch-type documentation drift.
## Finding The Editor's Stitch Type dropdown offers 5 values: `satin`, `fill`, `running`, `cross`, `zigzag`. The Editor's path-to-stitch-object mapper at `src/pages/Editor.tsx:113-114` looks for matches in the list `['satin', 'fill', 'running', 'cross-stitch', 'motif', 'zigzag']`. **The dropdown value `cross` does not match the lookup value `cross-stitch` (with a hyphen).** When a user picks "Cross Stitch" in the editor and exports, the find() returns `undefined` and the type silently falls back to `satin`. `zigzag` works because the lookup table includes it. `cross` does not. ## Where - Dropdown: `src/components/editor/EditorRightPanel.tsx:294-298` (`<option value="cross">Cross Stitch</option>`) - Lookup: `src/pages/Editor.tsx:113-114` (`['satin', 'fill', 'running', 'cross-stitch', 'motif', 'zigzag']`) - Editor stitch type state: `src/components/editor/types.ts` ## Suggested fix shape Two options: 1. **Rename the dropdown value to `cross-stitch`** (and add `motif` to the dropdown while at it). This aligns the editor dropdown with the lookup table. 2. **Normalize both sides in the editor's path-to-stitch mapper**: strip hyphens and lowercase before comparison, so `cross` matches `cross-stitch`. Simpler, less code change. Option 1 is the explicit fix; option 2 is the defensive fix that prevents future drift. Either is fine. Also: the lookup table has `motif` but the editor dropdown doesn't offer it. The Help page (in #109-era text) doesn't mention motif either. Decide whether motif is a real stitch type the user should be able to select, or remove it from the lookup. ## Severity Medium. A user picks Cross Stitch expecting a cross-stitch export, gets satin instead. Silent behavior; no error or warning. ## Discovered by Gap analysis (2026-10-02) of editor stitch type handling. ## Related - #130 (closed) — service returns 5 stitch types, editor exposes 3. The dropdown has been partially extended since then; this issue covers the remaining dropdown/lookup mismatch. - #109 (closed) — Help page "Steil Stitch" typo. Same family of stitch-type documentation drift.
Author
Owner

Fixed in commit 377951f on main.

Renamed the Editor dropdown option from value="cross" to value="cross-stitch" in src/components/editor/EditorRightPanel.tsx:297. The dropdown now matches the canonical StitchType literal (cross-stitch) used by Editor.tsx:113 lookup table, workspace/types.ts, workspace/RightPanel.tsx, canvasRenderer.ts, and stitch-adapters.ts.

Verification:

  • pnpm lint: clean
  • pnpm exec tsc -b: clean
  • vitest src/components/editor + src/pages/Editor: 43/43 pass
  • pre-existing 20 test failures in workspace/{ExportDialog,SettingsModal,Gallery} confirmed unrelated by stash-and-rerun on clean main
Fixed in commit 377951f on main. Renamed the Editor dropdown option from value="cross" to value="cross-stitch" in src/components/editor/EditorRightPanel.tsx:297. The dropdown now matches the canonical StitchType literal (cross-stitch) used by Editor.tsx:113 lookup table, workspace/types.ts, workspace/RightPanel.tsx, canvasRenderer.ts, and stitch-adapters.ts. Verification: - pnpm lint: clean - pnpm exec tsc -b: clean - vitest src/components/editor + src/pages/Editor: 43/43 pass - pre-existing 20 test failures in workspace/{ExportDialog,SettingsModal,Gallery} confirmed unrelated by stash-and-rerun on clean main
Mark closed this issue 2026-10-03 05:41:09 +00:00
Sign in to join this conversation.
No description provided.