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:
@@ -90,7 +90,15 @@ function layersFromContents(contents: unknown[]): Layer[] {
|
|||||||
|
|
||||||
function parseScene(value: unknown): Scene | null {
|
function parseScene(value: unknown): Scene | null {
|
||||||
if (!isRecord(value)) return 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 =
|
const name =
|
||||||
typeof value.name === "string"
|
typeof value.name === "string"
|
||||||
? value.name
|
? value.name
|
||||||
@@ -120,7 +128,7 @@ function parseScene(value: unknown): Scene | null {
|
|||||||
: "none";
|
: "none";
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: value.id,
|
id,
|
||||||
name,
|
name,
|
||||||
duration:
|
duration:
|
||||||
typeof value.duration === "number"
|
typeof value.duration === "number"
|
||||||
|
|||||||
Reference in New Issue
Block a user