Workspace has no Save Session button — exported designs can't be reloaded #63

Closed
opened 2026-09-10 17:56:27 +00:00 by Mark · 0 comments
Owner

Workspace has no Save Session button — exported designs can't be reloaded

Repo: Mark/Kimi_Agent_Brother_10_Digitizing_App
Severity: Medium
Found: 2026-09-10, webui usability shakedown

Problem

After digitizing and exporting a PES from the Workspace, there is no way to save the
working session back into the Gallery. Two failures observed:

  1. Workspace (src/pages/Workspace.tsx) has no Save action. The header (AppHeader)
    exposes only onExport — no onSave / saveCurrent / addDesign hook. The useWorkspace.ts
    hook (handleFileUpload) dispatches SET_IMAGE + SET_DESIGN_SETTING to in-memory state
    but never calls saveDesigns from src/components/gallery/data.ts. Designs only enter
    state during the upload, and the Workspace state is wiped on reload.

  2. Gallery's "Upload Design" is a mock. src/pages/Gallery.tsx:140-154
    (handleUploadDesign) synthesizes a fake Design with random stitchCount and a generated
    filename — it never reads the dropped/selected file:

const mockDesign: Design = {
  id: `design-${Date.now()}`,
  filename: `uploaded_design_${Math.floor(Math.random() * 1000)}.pes`,
  // ... no file content read
};
setDesigns((prev) => [mockDesign, ...prev]);
showToast('Design uploaded to Unsorted');

Reproduction

  1. Start dev: pnpm dev in repo root (Vite on :5173, proxy to localhost:8080).
  2. Navigate to /workspace, upload any image, run Auto-Digitize, export PES →
    file lands in ~/Downloads/.
  3. Navigate to /gallery.
  4. Click "Upload Design". Expected: file picker. Actual: a fake Design with a
    random uploaded_design_<NNN>.pes filename appears, regardless of any file you may
    or may not have selected.
  5. Reload the page — Workspace state is gone, exported PES is not in Gallery.

Suggested fix

  • Add a Save to Gallery button in the Workspace header (AppHeader), wired to a new
    saveCurrentDesign handler in useWorkspace.ts that calls saveDesigns (or a new
    addDesign(design) if you don't want to overwrite the whole list).
  • Replace the mock handleUploadDesign in Gallery.tsx with a real file input + read,
    parse PES/DST header to populate stitchCount / threadCount, and persist via
    saveDesigns.

Acceptance

  • After Auto-Digitize + Export, a Save action in the Workspace makes the design
    appear in /gallery and survives page reload.
  • Gallery's Upload Design button reads the actual file (PES/DST/SVG/PDF) and shows
    accurate stitchCount and threadCount, not random values.
## Workspace has no Save Session button — exported designs can't be reloaded **Repo:** Mark/Kimi_Agent_Brother_10_Digitizing_App **Severity:** Medium **Found:** 2026-09-10, webui usability shakedown ## Problem After digitizing and exporting a PES from the Workspace, there is no way to save the working session back into the Gallery. Two failures observed: 1. **Workspace (`src/pages/Workspace.tsx`)** has no Save action. The header (`AppHeader`) exposes only `onExport` — no `onSave` / `saveCurrent` / `addDesign` hook. The `useWorkspace.ts` hook (`handleFileUpload`) dispatches `SET_IMAGE` + `SET_DESIGN_SETTING` to in-memory state but never calls `saveDesigns` from `src/components/gallery/data.ts`. Designs only enter state during the upload, and the Workspace state is wiped on reload. 2. **Gallery's "Upload Design" is a mock.** `src/pages/Gallery.tsx:140-154` (`handleUploadDesign`) synthesizes a fake Design with random `stitchCount` and a generated filename — it never reads the dropped/selected file: ```ts const mockDesign: Design = { id: `design-${Date.now()}`, filename: `uploaded_design_${Math.floor(Math.random() * 1000)}.pes`, // ... no file content read }; setDesigns((prev) => [mockDesign, ...prev]); showToast('Design uploaded to Unsorted'); ``` ## Reproduction 1. Start dev: `pnpm dev` in repo root (Vite on `:5173`, proxy to `localhost:8080`). 2. Navigate to `/workspace`, upload any image, run Auto-Digitize, export PES → file lands in `~/Downloads/`. 3. Navigate to `/gallery`. 4. Click "Upload Design". Expected: file picker. Actual: a fake Design with a random `uploaded_design_<NNN>.pes` filename appears, regardless of any file you may or may not have selected. 5. Reload the page — Workspace state is gone, exported PES is not in Gallery. ## Suggested fix - Add a `Save to Gallery` button in the Workspace header (`AppHeader`), wired to a new `saveCurrentDesign` handler in `useWorkspace.ts` that calls `saveDesigns` (or a new `addDesign(design)` if you don't want to overwrite the whole list). - Replace the mock `handleUploadDesign` in `Gallery.tsx` with a real file input + read, parse PES/DST header to populate `stitchCount` / `threadCount`, and persist via `saveDesigns`. ## Acceptance - After Auto-Digitize + Export, a Save action in the Workspace makes the design appear in `/gallery` and survives page reload. - Gallery's Upload Design button reads the actual file (PES/DST/SVG/PDF) and shows accurate stitchCount and threadCount, not random values.
Mark closed this issue 2026-09-10 18:24:55 +00:00
Sign in to join this conversation.
No description provided.