mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 01:38:44 +00:00
When the user undoes a color change while the Object Panel is open, the THREE.js material reverts correctly but the panel's local React `color` state stays at the redo value — the panel preview Button and the color input value disagree with the actual scene material. Root cause: the per-frame `getSelectedSum` check in renderSingleFrame pushes a fresh `objectPanel` slice to Zustand whenever transforms change, which re-fires the panel's useEffect and re-reads userData.color. Color changes don't move the sum, so the push never happens after a color undo/redo. Fix: ColorAction.apply/revert now calls `editor.selection.updateSelectedUI()` after the engine setColor. That pushes a new currentSceneObject reference into Zustand, the panel's [currentSceneObject] effect fires, and `setColor(editorEngine?.selected?.userData.color)` reads the freshly reverted value. Same pattern the lock/transform paths already use for UI sync.