Files
artcraft/frontend/apps
Tanish Manku 72071c0066 PageScene: stop panel undo pollution from color + transform inputs
Two related session-boundary bugs in ControlPanelSceneObject — both
caused N undo entries per user gesture instead of one.

Bug A (color picker):
- Native <input type="color"> fires onChange on every slider pixel
  while the dialog is open, not just on commit. The previous one-shot
  setObjectColor recorded one ColorAction per fire, so a single
  white→red pick became dozens of micro-entries. Ctrl+Z reverted only
  the last micro-step → user reported "undo doesn't work."
- Fix: add ColorSession to actions/setObjectColor (apply/commit
  pair). Panel opens it on input.onFocus, applies on onChange (visual
  feedback only), commits on onBlur (one entry per pick).

Bug B (panel transform inputs — keystrokes AND scrub drags):
- The panel's [currentSceneObject] useEffect cleanup was committing
  the transform session on every frame the selected obj's transform
  changed. The chain: panel writes to engine -> next frame
  editor.ts:744 sees getSelectedSum changed -> updateSelectedUI()
  pushes a fresh objectPanel into Zustand -> currentSceneObject
  reference changes -> useEffect cleanup fires -> commitPanelTransform.
  Result: one entry per keystroke, dozens per scrub drag.
- Fix: track lastUuidRef. Commit the session only when the selection
  uuid actually changes (real boundary), not on every same-uuid
  re-push. Move the unmount-commit into a separate effect.

Both fixes use the same shape: a session ref opened on first edit
and committed at a properly-throttled boundary (focus/blur for color,
uuid-change/unmount for transform). Mirrors the engine-side
TransformAction begin/commit pattern.
2026-05-01 04:40:02 -07:00
..
2026-03-12 21:35:29 +07:00