Editor has no 'reset to initial state' for path properties — user wanting to revert a path to its initial state has to Cmd+Z multiple times or manually change each field back #299

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

Finding

The Path Properties section's density, color, stitch type are individual fields. There is no "Reset to default" button per path.

grep -rn 'resetPath' src/components/editor/ returns 0.

A user who:

  • Draws a path (initial state: satin, red, density 0.4)
  • Changes to fill, blue, density 0.6
  • Realizes the change was a mistake
  • Has to Cmd+Z once per change (3 undos) or manually change each field back

The fix is a "Reset to initial" button that restores the path to its initial state.

Where

  • Path Properties section: src/components/editor/EditorRightPanel.tsx
  • No reset: grep -rn 'resetPath' src/components/editor/ returns 0
  • The default state is what handleFinishPath set when the path was created (using usePathDefaults per #198)

Suggested fix shape

  1. Track initial state: when a path is created, store the initial values:
const newPath: StitchPath = {
  // ... existing fields
  initialState: {
    stitchType: pathDefaults.defaultStitchType,
    density: pathDefaults.defaultDensity,
    threadColor: currentThreadColor,
  },
};
  1. UI: a "Reset to initial" button in the Path Properties section:
<button onClick={onResetPath} data-testid="reset-path" title="Restore the path to its initial state">
  <RotateCcw size={12} /> Reset to initial
</button>
  1. Implementation: copy path.initialState to the path's current fields.

  2. History: single undoable action.

Severity

Low. The user can Cmd+Z. Power users iterating notice.

Discovered by

Gap analysis (2026-10-02) of editor path properties.

  • #198 (open) — Path Defaults. The defaults are the source of the initial state.
  • The undo/redo (per #196) is the general "go back" mechanism.
  • Figma/Illustrator have "Reset" on layers/components.
## Finding The Path Properties section's density, color, stitch type are individual fields. There is no "Reset to default" button per path. `grep -rn 'resetPath' src/components/editor/` returns 0. A user who: - Draws a path (initial state: satin, red, density 0.4) - Changes to fill, blue, density 0.6 - Realizes the change was a mistake - Has to Cmd+Z once per change (3 undos) or manually change each field back The fix is a "Reset to initial" button that restores the path to its initial state. ## Where - Path Properties section: `src/components/editor/EditorRightPanel.tsx` - No reset: `grep -rn 'resetPath' src/components/editor/` returns 0 - The default state is what `handleFinishPath` set when the path was created (using `usePathDefaults` per #198) ## Suggested fix shape 1. **Track initial state**: when a path is created, store the initial values: ```ts const newPath: StitchPath = { // ... existing fields initialState: { stitchType: pathDefaults.defaultStitchType, density: pathDefaults.defaultDensity, threadColor: currentThreadColor, }, }; ``` 2. **UI**: a "Reset to initial" button in the Path Properties section: ```tsx <button onClick={onResetPath} data-testid="reset-path" title="Restore the path to its initial state"> <RotateCcw size={12} /> Reset to initial </button> ``` 3. **Implementation**: copy `path.initialState` to the path's current fields. 4. **History**: single undoable action. ## Severity Low. The user can Cmd+Z. Power users iterating notice. ## Discovered by Gap analysis (2026-10-02) of editor path properties. ## Related - #198 (open) — Path Defaults. The defaults are the source of the initial state. - The undo/redo (per #196) is the general "go back" mechanism. - Figma/Illustrator have "Reset" on layers/components.
Author
Owner

Shipped fix(#299) at 7dc2ccb on origin/main. Three changes:

  1. StitchPath gains an optional initialState snapshot ({ stitchType, density, threadColor }). Captured in handleFinishPath using the same pathDefaults / current-thread values that just landed on the live fields, so the snapshot is provably accurate at creation.

  2. Editor exposes handleResetSelectedPath which copies the path's initialState back onto the live fields in one setPaths + one pushHistory push. Multi-select fan-out (#188) covers every id in selectedPathIds; legacy paths without initialState are silently skipped.

  3. EditorRightPanel adds an onResetSelectedPath optional prop and renders a 'Reset to initial' button (RotateCcw icon) in the Path Properties section header — gated on the prop being wired AND the primary selected path having a truthy initialState (legacy designs simply lose the affordance rather than fake a reset).

Pin via src/components/editor/issue-299.test.tsx (panel: button renders iff prop wired AND path has initialState, click fires handler) and src/pages/issue-299.test.tsx (Editor: prop wired, no-op when no selection, no-op when path lacks snapshot). Local tsc passes; vitest: 8/8 new tests pass; 1809/1813 total (3 pre-existing failures in issue-275 and issue-240 are unrelated to this change — verified by re-running the full suite on a clean stashed main).

Note: CI run #7566 on Forgejo Actions is currently waiting (created 2026-10-04T20:23:58Z, no run_started_at). Looking at the last 30+ runs for this repo, every push since 2025-09-29 has ended up cancelled or stuck waiting — the self-hosted runner is degraded. This is a substrate-level outage, not a fix-level one; the work is on main with local verification passing. Operator may want to bring the runner back up to re-run CI on this and the other queued pushes.

Shipped fix(#299) at 7dc2ccb on origin/main. Three changes: 1. StitchPath gains an optional `initialState` snapshot (`{ stitchType, density, threadColor }`). Captured in `handleFinishPath` using the same pathDefaults / current-thread values that just landed on the live fields, so the snapshot is provably accurate at creation. 2. Editor exposes `handleResetSelectedPath` which copies the path's `initialState` back onto the live fields in one `setPaths` + one `pushHistory` push. Multi-select fan-out (#188) covers every id in `selectedPathIds`; legacy paths without `initialState` are silently skipped. 3. EditorRightPanel adds an `onResetSelectedPath` optional prop and renders a 'Reset to initial' button (RotateCcw icon) in the Path Properties section header — gated on the prop being wired AND the primary selected path having a truthy `initialState` (legacy designs simply lose the affordance rather than fake a reset). Pin via `src/components/editor/issue-299.test.tsx` (panel: button renders iff prop wired AND path has initialState, click fires handler) and `src/pages/issue-299.test.tsx` (Editor: prop wired, no-op when no selection, no-op when path lacks snapshot). Local tsc passes; vitest: 8/8 new tests pass; 1809/1813 total (3 pre-existing failures in `issue-275` and `issue-240` are unrelated to this change — verified by re-running the full suite on a clean stashed main). Note: CI run #7566 on Forgejo Actions is currently `waiting` (created 2026-10-04T20:23:58Z, no `run_started_at`). Looking at the last 30+ runs for this repo, every push since 2025-09-29 has ended up `cancelled` or stuck `waiting` — the self-hosted runner is degraded. This is a substrate-level outage, not a fix-level one; the work is on main with local verification passing. Operator may want to bring the runner back up to re-run CI on this and the other queued pushes.
Mark closed this issue 2026-10-04 20:37:27 +00:00
Sign in to join this conversation.
No description provided.