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: drop superseded publish-draft responses when the project changes (#10147)

Adam Eivyc3010b44faba
diff --git a/client/src/hooks/useMusicVideoPublishing.js b/client/src/hooks/useMusicVideoPublishing.js
index adf61c8a09..a91fd786be 100644
--- a/client/src/hooks/useMusicVideoPublishing.js
+++ b/client/src/hooks/useMusicVideoPublishing.js
@@ -55,7 +55,8 @@ export default function useMusicVideoPublishing({ project, replaceProject } = {}
// (a tab filled elsewhere, closed by hand, or discarded).
useEffect(() => {
if (!projectId) return undefined;
- const apply = (list) => { for (const d of list) if (d.state !== 'discarded') setFor('drafts', d.target, d); };
+ let cancelled = false;
+ const apply = (list) => { if (cancelled) return; for (const d of list) if (d.state !== 'discarded') setFor('drafts', d.target, d); };
getMusicVideoPublishDrafts(projectId, { silent: true }).then((res) => apply(res?.drafts || [])).catch(() => {});
const onDraft = (e) => {
if (e?.projectId !== projectId) return;
@@ -76,7 +77,7 @@ export default function useMusicVideoPublishing({ project, replaceProject } = {}
}
};
socket.on('music-video:publish-draft', onDraft);
- return () => socket.off('music-video:publish-draft', onDraft);
+ return () => { cancelled = true; socket.off('music-video:publish-draft', onDraft); };
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [projectId, scope]);