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

fix: keep a landing poster from restarting the open animation's preview

[._.]/ Adam Eivy0e97ff8bfe04
diff --git a/client/src/pages/CodeAnimation.jsx b/client/src/pages/CodeAnimation.jsx
index e092dedc69..fcb557c75c 100644
--- a/client/src/pages/CodeAnimation.jsx
+++ b/client/src/pages/CodeAnimation.jsx
@@ -350,7 +350,9 @@ function FastCodeAnimation() {
namespace: 'code-animation',
events: JOB_EVENTS,
resourceKey: jobId,
- matchesEvent: (payload) => !!jobId && payload?.id === jobId,
+ // A poster event changes only the gallery; re-reading the job would hand the
+ // preview a new frame object and restart a session the user is watching.
+ matchesEvent: (payload) => !!jobId && payload?.id === jobId && payload.kind !== 'poster',
});
useEffect(() => {
diff --git a/client/src/pages/CodeAnimation.test.jsx b/client/src/pages/CodeAnimation.test.jsx
index 420ecf2629..207e9af0b6 100644
--- a/client/src/pages/CodeAnimation.test.jsx
+++ b/client/src/pages/CodeAnimation.test.jsx
@@ -178,6 +178,8 @@ describe('Code Animation page', () => {
await emitSocket('code-animation:changed', { id: 'unrelated-job' });
expect(getCodeAnimationJob).toHaveBeenCalledTimes(1);
+ await emitSocket('code-animation:changed', { id: 'job-1', kind: 'poster' });
+ expect(getCodeAnimationJob).toHaveBeenCalledTimes(1);
getCodeAnimationJob.mockResolvedValue(completedJob);
await emitSocket('code-animation:changed', { id: 'job-1' });
expect(getCodeAnimationJob).toHaveBeenCalledTimes(2);
diff --git a/server/lib/socketEventContracts.js b/server/lib/socketEventContracts.js
index 9b174a6559..957001dbfc 100644
--- a/server/lib/socketEventContracts.js
+++ b/server/lib/socketEventContracts.js
@@ -416,8 +416,8 @@ export const SOCKET_EVENT_CONTRACTS = Object.freeze({
},
'code-animation:changed': {
direction: 'server-to-client',
- summary: 'Invalidate bounded Code Animation job/project galleries and matching details after a durable change.',
- payloadSchema: { type: 'object', properties: { id: { type: 'string' } }, required: ['id'], additionalProperties: false },
+ summary: 'Invalidate bounded Code Animation job/project galleries and matching details after a durable change; kind "poster" means only the gallery thumbnail changed.',
+ payloadSchema: { type: 'object', properties: { id: { type: 'string' }, kind: { type: 'string', enum: ['poster'] } }, required: ['id'], additionalProperties: false },
},
'mood-board:analyze': {
diff --git a/server/services/codeAnimation/poster.js b/server/services/codeAnimation/poster.js
index eba03444b6..111cc10563 100644
--- a/server/services/codeAnimation/poster.js
+++ b/server/services/codeAnimation/poster.js
@@ -93,7 +93,7 @@ export function captureCodeAnimationPoster(id) {
const run = tail.then(() => capture(id)).then((written) => {
if (written) {
console.log(`🖼️ Code animation ${id.slice(0, 8)} poster captured`);
- emitCodeAnimationChanged(id);
+ emitCodeAnimationChanged(id, 'poster');
} else {
failed.add(id);
}
diff --git a/server/services/socket.js b/server/services/socket.js
index c54ddd0056..90c6990f1c 100644
--- a/server/services/socket.js
+++ b/server/services/socket.js
@@ -107,8 +107,8 @@ export function getIo() {
const ALL_SUBSCRIBER_SETS = [cosSubscribers, errorSubscribers, notificationSubscribers, agentSubscribers, instanceSubscribers, loopSubscribers, codeAnimationSubscribers, beeperSubscribers, fableLoomSubscribers, commandSubscribers];
-export function emitCodeAnimationChanged(id) {
- broadcastToSet(codeAnimationSubscribers, 'code-animation:changed', { id });
+export function emitCodeAnimationChanged(id, kind) {
+ broadcastToSet(codeAnimationSubscribers, 'code-animation:changed', kind ? { id, kind } : { id });
}
/** Emit a `command:<id>:*` frame to sockets that sent `command:subscribe`. */