Code-first video & image, rendered natively on WebGPU.
Keep drawing preview frames after one comes from the frame cache
Silvio Tomatiscf04e38cc365
diff --git a/.changeset/preview-cached-frame-stall.md b/.changeset/preview-cached-frame-stall.mdnew file mode 100644index 00000000..fc39b7a3--- /dev/null+++ b/.changeset/preview-cached-frame-stall.md@@ -0,0 +1,5 @@+---+"framefields": patch+---++Preview: drawing no longer stops for good after a frame is shown from the frame cache (stepping or scrubbing back to a frame drawn before).diff --git a/packages/framefields/src/preview/player.ts b/packages/framefields/src/preview/player.tsindex 923a0dc1..7d3be032 100644--- a/packages/framefields/src/preview/player.ts+++ b/packages/framefields/src/preview/player.ts@@ -346,7 +346,13 @@ async function createPlayer(// latest; warm-ups only run when nothing else is drawing.function pump(): void {if (drawing || wanted === null) return;- drawing = (async () => {+ // `drawing` is set before the loop runs: a frame from the cache is drawn+ // without awaiting, so the loop can finish (and clear it) synchronously.+ let finished!: () => void;+ drawing = new Promise<void>((resolve) => {+ finished = resolve;+ });+ void (async () => {while (wanted !== null) {const f = wanted;wanted = null;@@ -370,6 +376,7 @@ async function createPlayer(}}drawing = null;+ finished();})();}