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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: discard storyboard updates after the selected issue changes
[._.]/ Adam Eivyc03b06bf5d90
diff --git a/client/src/components/pipeline/stages/StoryboardsStage.jsx b/client/src/components/pipeline/stages/StoryboardsStage.jsxindex c450dc04e7..06be38a447 100644--- a/client/src/components/pipeline/stages/StoryboardsStage.jsx+++ b/client/src/components/pipeline/stages/StoryboardsStage.jsx@@ -39,6 +39,7 @@ import {} from '../../../services/api';import useUniverse from '../../../hooks/useUniverse';import { useSocketResource } from '../../../hooks/useSocketResource';+import useMounted from '../../../hooks/useMounted';import { matchCharactersInText } from '../../../lib/scenePrompt';import MediaJobThumb from '../MediaJobThumb';import ImagePromptCandidates, { PromptCountInput } from '../ImagePromptCandidates';@@ -149,13 +150,25 @@ export default function StoryboardsStage({ issue, series, onStageUpdate, actionsmatchesEvent: event => !boardChanges?.boardId || event?.id === boardChanges.boardId,},);- const [updatingFromBoard, setUpdatingFromBoard] = useState(null);+ const mounted = useMounted();+ const boardUpdateRef = useRef({ issueId: issue.id, generation: 0, pending: false });+ if (boardUpdateRef.current.issueId !== issue.id) {+ boardUpdateRef.current = { issueId: issue.id, generation: boardUpdateRef.current.generation + 1, pending: false };+ }+ const [boardUpdate, setBoardUpdate] = useState(null);+ const updatingFromBoard = boardUpdate?.issueId === issue.id && boardUpdate.generation === boardUpdateRef.current.generation+ ? boardUpdate.shotId : null;const changedShots = useMemo(() => new Map((boardChanges?.changed || []).map((c) => [c.shotId, c])), [boardChanges]);const boardLocked = stage.locked === true;const updateFromBoard = async (shotId = null) => {- setUpdatingFromBoard(shotId || 'all');+ if (boardUpdateRef.current.pending) return;+ const request = { issueId: issue.id, generation: boardUpdateRef.current.generation + 1, pending: true };+ boardUpdateRef.current = request;+ setBoardUpdate({ ...request, shotId: shotId || 'all' });const res = await updatePipelineShotsFromBoard(issue.id, shotId).catch(() => null);- setUpdatingFromBoard(null);+ if (!mounted.current || boardUpdateRef.current !== request) return;+ boardUpdateRef.current = { ...request, pending: false };+ setBoardUpdate(null);if (!res) return;const { updated, issue: saved, ...changes } = res;setBoardChanges(changes);diff --git a/client/src/components/pipeline/stages/StoryboardsStage.test.jsx b/client/src/components/pipeline/stages/StoryboardsStage.test.jsxindex 931b5a2af2..e2e477d25c 100644--- a/client/src/components/pipeline/stages/StoryboardsStage.test.jsx+++ b/client/src/components/pipeline/stages/StoryboardsStage.test.jsx@@ -91,4 +91,19 @@ describe('StoryboardsStage', () => {expect(screen.queryByText(/Storyboard changed/)).not.toBeInTheDocument();expect(api.getPipelineStoryboardChanges).toHaveBeenCalledTimes(2);});++ it('does not apply an earlier issue’s pending storyboard update after selecting another issue', async () => {+ const changed = { boardId: 'sb-1', locked: false, changed: [{ sceneId: 'scene-01', shotId: 'shot-01', panelId: 'panel-1', fields: ['description'] }] };+ const withShot = { ...issue, stages: { storyboards: { status: 'edited', scenes: [{ ...issue.stages.storyboards.scenes[0], shots: [{ id: 'shot-01', description: 'Wide of the lab', durationSeconds: 5 }] }] } } };+ api.getPipelineStoryboardChanges.mockResolvedValueOnce(changed);+ let finishUpdate;+ api.updatePipelineShotsFromBoard.mockImplementationOnce(() => new Promise(resolve => { finishUpdate = resolve; }));+ const onStageUpdate = vi.fn();+ const view = render(<MemoryRouter><StoryboardsStage issue={withShot} series={null} onStageUpdate={onStageUpdate} /></MemoryRouter>);+ fireEvent.click(await screen.findByRole('button', { name: 'Update' }));+ const nextIssue = { ...withShot, id: 'iss-2' };+ view.rerender(<MemoryRouter><StoryboardsStage issue={nextIssue} series={null} onStageUpdate={onStageUpdate} /></MemoryRouter>);+ await act(async () => { finishUpdate({ updated: 1, issue: withShot, boardId: 'sb-1', locked: false, changed: [] }); });+ expect(onStageUpdate).not.toHaveBeenCalled();+ });});