Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (agy): repaint the Core avatar on a state change under reduced motion

[._.]/ Adam Eivydb9f1dfd64f4
diff --git a/client/src/components/cos/CoreCoSAvatar.jsx b/client/src/components/cos/CoreCoSAvatar.jsx
index b85075c1e9..b0bffa32a9 100644
--- a/client/src/components/cos/CoreCoSAvatar.jsx
+++ b/client/src/components/cos/CoreCoSAvatar.jsx
@@ -144,6 +144,12 @@ export default function CoreCoSAvatar({ state = 'sleeping', speaking = false, ba
};
}, [paletteRef, reduceMotion]);
+ // Under reduced motion the loop is halted, so a state change (new edge color)
+ // has to ask for its one frame explicitly.
+ useEffect(() => {
+ if (reduceMotion) drawRef.current?.();
+ }, [state, speaking, reduceMotion]);
+
return (
<CoSAvatarFrame label="Core assembly avatar. Drag to rotate." background={background}>
<div ref={wrapRef} className="absolute inset-0">
diff --git a/client/src/components/cos/CoreCoSAvatar.test.jsx b/client/src/components/cos/CoreCoSAvatar.test.jsx
index 71f883fda2..cd0e71a277 100644
--- a/client/src/components/cos/CoreCoSAvatar.test.jsx
+++ b/client/src/components/cos/CoreCoSAvatar.test.jsx
@@ -97,12 +97,17 @@ describe('CoreCoSAvatar', () => {
it('holds a single static frame when the user prefers reduced motion', () => {
reduceMotion = true;
- render(<CoreCoSAvatar state="thinking" />);
+ const { rerender } = render(<CoreCoSAvatar state="thinking" />);
const initialFrames = drawCalls.length;
tick(16);
// The loop drew its one frame and did not schedule another.
expect(drawCalls.length).toBe(initialFrames + 1);
expect(rafCallbacks).toHaveLength(0);
expect(drawCalls.at(-1).pulse).toBe(0);
+
+ // With no loop running, a state change still repaints once in its color.
+ rerender(<CoreCoSAvatar state="coding" />);
+ expect(rafCallbacks).toHaveLength(0);
+ expect(drawCalls.at(-1).edgeRgb).toEqual(rgbOf(AGENT_STATES.coding.color));
});
});