fix(studio): accept numeric scene/content ids (template inputs now load)

THE bug behind 'nothing changed': parseScene required a STRING id, but the V2
relational scene assembly serializes numeric ids (scene 23, content 136) — so every
template scene was rejected → 0 scenes → studio fell back to its default 2-layer
title/subtitle. Coerce numeric ids to string. Verified: insta-promo project now
parses 1 scene / 6 layers (frl_c1t1-t4 text + frl_c1m1/m2 media).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-07 07:27:53 +03:30
parent 04ca431fbc
commit 2879198dec
+10 -2
View File
@@ -90,7 +90,15 @@ function layersFromContents(contents: unknown[]): Layer[] {
function parseScene(value: unknown): Scene | null {
if (!isRecord(value)) return null;
if (typeof value.id !== "string") return null;
// Studio's own save format uses string ids; the V2 relational assembly uses numeric
// ids — accept both (coerce to string).
const id =
typeof value.id === "string"
? value.id
: typeof value.id === "number"
? String(value.id)
: null;
if (id === null) return null;
const name =
typeof value.name === "string"
? value.name
@@ -120,7 +128,7 @@ function parseScene(value: unknown): Scene | null {
: "none";
return {
id: value.id,
id,
name,
duration:
typeof value.duration === "number"