molecule-core/canvas/src
Canvas Agent 026921ae62 fix(canvas): persist SidePanel width to localStorage (issue #425)
Width was initialized to 480px on every render, so clicking a different
workspace node (which re-mounts SidePanel) discarded any resize the user
had done.

Fix:
- localStorage-backed useState initializer (SSR-safe typeof window guard)
- Validates the stored value: must be a finite integer ≥ 320px
- Persists the width in the mouseUp handler via a widthRef that stays in
  sync with the live drag value — avoids spamming localStorage on every
  pixel during the drag
- Extra guard: onMouseUp bails early if not actually dragging (prevents
  spurious saves on unrelated window mouseup events)
- Named constants replace magic numbers 480 / 320

Tests: 5 new cases in SidePanel.tabs.test.tsx — default fallback, valid
saved value, too-small saved value, NaN saved value, drag-persist roundtrip.

Closes #425

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 10:40:08 +00:00
..
__tests__ fix(a11y): prefers-reduced-motion WCAG 2.3.3 compliance 2026-04-14 11:25:23 +00:00
app Merge pull request #251 from Molecule-AI/feat/cookie-consent-banner 2026-04-15 13:49:53 -07:00
components fix(canvas): persist SidePanel width to localStorage (issue #425) 2026-04-16 10:40:08 +00:00
hooks initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
lib feat(tenant): combined platform + canvas Docker image with reverse proxy 2026-04-16 02:46:47 -07:00
store fix(canvas): replace nodes.length grid index with monotonic sequence counter (#388) 2026-04-16 00:25:33 -07:00
stores initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
styles fix(canvas): dark theme a11y — settings buttons, input fields, ReactFlow colorMode, zinc-400 contrast, aria-labels 2026-04-15 07:56:53 +00:00
types initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
middleware.ts initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00