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

review: fix blank-canvas paper fill, thumbnail cache-bust, same-size sketch nav

[._.]/ Adam Eivy67a364360c6e
diff --git a/client/src/components/media/AnnotationCanvas.jsx b/client/src/components/media/AnnotationCanvas.jsx
index 25f1bdf44d..16dae7d7f8 100644
--- a/client/src/components/media/AnnotationCanvas.jsx
+++ b/client/src/components/media/AnnotationCanvas.jsx
@@ -59,24 +59,18 @@ const AnnotationCanvas = forwardRef(function AnnotationCanvas(
// Redraw the whole layer from the committed strokes plus any in-progress
// stroke. Full redraw (rather than incremental) keeps undo/erase trivially
- // correct — the layer is a pure function of the stroke list. In blank mode the
- // background fills first so erase (destination-out) reveals the paper, not the
- // page behind the canvas.
+ // correct — the layer is a pure function of the stroke list. The stroke layer
+ // itself always stays transparent (drawStrokes clears it, and erase uses
+ // destination-out to cut holes); in blank mode the "paper" is a CSS background
+ // on the <canvas> element so an erased hole reveals white, not the dark page.
useEffect(() => {
const canvas = canvasRef.current;
if (!canvas || !dims) return;
const ctx = canvas.getContext('2d');
if (!ctx) return;
- ctx.clearRect(0, 0, canvas.width, canvas.height);
- if (isBlank) {
- ctx.save();
- ctx.fillStyle = backgroundColor;
- ctx.fillRect(0, 0, canvas.width, canvas.height);
- ctx.restore();
- }
const all = inProgress ? [...strokes, inProgress] : strokes;
drawStrokes(ctx, all, canvas.width, canvas.height);
- }, [strokes, inProgress, dims, isBlank, backgroundColor]);
+ }, [strokes, inProgress, dims]);
// Map a pointer event to natural-pixel canvas coordinates, accounting for the
// CSS scale between the displayed size and the canvas's internal resolution.
@@ -179,6 +173,10 @@ const AnnotationCanvas = forwardRef(function AnnotationCanvas(
onPointerMove={handlePointerMove}
onPointerUp={finishStroke}
onPointerCancel={finishStroke}
+ // Blank mode paints the "paper" as a CSS background so the transparent
+ // stroke layer sits over it and an erased hole reveals white, not the
+ // dark page behind the canvas.
+ style={isBlank ? { backgroundColor } : undefined}
className="absolute inset-0 w-full h-full touch-none cursor-crosshair"
/>
)}
diff --git a/client/src/components/pipeline/stages/StoryboardsStage.jsx b/client/src/components/pipeline/stages/StoryboardsStage.jsx
index 57326715fd..6d45113c10 100644
--- a/client/src/components/pipeline/stages/StoryboardsStage.jsx
+++ b/client/src/components/pipeline/stages/StoryboardsStage.jsx
@@ -16,9 +16,10 @@
* extractor against the corresponding text stage and replace the list.
*/
-import { useMemo, useRef, useState } from 'react';
+import { useEffect, useMemo, useRef, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { Plus, Trash2, Sparkles, Loader2, Wand2, Film, WandSparkles, Shirt, Layers, Pencil } from 'lucide-react';
+import socket from '../../../services/socket';
import toast from '../../ui/Toast';
import InlineConfirmRow from '../../ui/InlineConfirmRow';
import { SHOT_TYPES, SCREEN_DIRECTIONS, SHOT_TYPE_LABELS, SCREEN_DIRECTION_LABELS } from '../../../lib/shotGrammar';
@@ -46,6 +47,23 @@ export default function StoryboardsStage({ issue, series, onStageUpdate, actions
// Scene index currently minting a blank sketch (so its button shows a spinner
// and can't be double-clicked while the POST is in flight).
const [sketchingIdx, setSketchingIdx] = useState(null);
+ // Cache-bust token per sketch key so the inline `/png` thumbnail refreshes
+ // after an edit. Seeded once at mount (so a return from the annotate page
+ // re-fetches) and bumped live when the server broadcasts `media:sketch:updated`.
+ const [sketchNonces, setSketchNonces] = useState({});
+ const mountNonceRef = useRef(0);
+ if (mountNonceRef.current === 0) mountNonceRef.current = Date.now();
+
+ useEffect(() => {
+ const onSketchUpdated = ({ key }) => {
+ if (!key) return;
+ setSketchNonces((prev) => ({ ...prev, [key]: (prev[key] || mountNonceRef.current) + 1 }));
+ };
+ socket.on('media:sketch:updated', onSketchUpdated);
+ return () => socket.off('media:sketch:updated', onSketchUpdated);
+ }, []);
+ const sketchSrc = (key) =>
+ `/api/media/sketches/${encodeURIComponent(key)}/png?v=${sketchNonces[key] || mountNonceRef.current}`;
// Per-stage gen config — edited from the page-level settings modal.
const genConfig = stage.genConfig || null;
const [savingIdx, setSavingIdx] = useState(null);
@@ -576,10 +594,11 @@ export default function StoryboardsStage({ issue, series, onStageUpdate, actions
title="Open this scene’s storyboard sketch"
className="block rounded border border-port-border overflow-hidden hover:border-port-accent/50"
>
- {/* The flattened PNG sidecar is served at /png; the query
- key busts the cache after each save (updatedAt broadcast). */}
+ {/* The flattened PNG sidecar is served at /png; the ?v
+ nonce (seeded at mount, bumped on media:sketch:updated)
+ busts the browser cache after each save. */}
<img
- src={`/api/media/sketches/${encodeURIComponent(scene.sketchKey)}/png`}
+ src={sketchSrc(scene.sketchKey)}
alt={`Scene ${i + 1} sketch`}
className="w-full h-auto"
onError={(e) => { e.currentTarget.style.display = 'none'; }}
diff --git a/client/src/pages/MediaAnnotate.jsx b/client/src/pages/MediaAnnotate.jsx
index 1bf4b210e9..3ce5f30f63 100644
--- a/client/src/pages/MediaAnnotate.jsx
+++ b/client/src/pages/MediaAnnotate.jsx
@@ -102,7 +102,12 @@ export default function MediaAnnotate() {
if (!isSupported) { setLoading(false); return; }
let active = true;
setStrokes([]);
- setDims(null);
+ // In image mode dims come from the <img> onLoad, which re-fires when the src
+ // changes — so reset to null and let it re-report. In blank mode dims derive
+ // from the (stable-per-key) URL size params; the child's dims effect won't
+ // re-fire when navigating sketch→sketch at the same w/h, so clearing here
+ // would strand Save disabled (`!dims`). Leave blank dims in place.
+ if (!isBlank) setDims(null);
setImageError(false);
setLoading(true);
getMediaSketch(mediaKey, { silent: true })