refactor(studio): tighten the expanded-lane cache and height helpers

Validate the parse response before reading `.animations` instead of casting
the JSON blind, and narrow the fetch's return type to the slice callers read.
Route the AST cache load through the shared clip-keyframe and cache-key
helpers so it can't drift from the other writer. Drop the unused numeric
track-count branches from `trackHeights`/`getTimelineCanvasHeight`, and pick
the widest keyframed clip with a reduce so there's no index assertion.
This commit is contained in:
Miguel Angel Simon Sierra
2026-07-28 00:40:44 +02:00
parent 629631a72e
commit 538264463c
6 changed files with 53 additions and 50 deletions
@@ -36,7 +36,7 @@ export type ElementAnimationsOutcome =
* so the caller can apply the right retry budget to each.
*/
export function selectElementAnimationsOrRetry(
parsed: ParsedGsap | null,
parsed: Pick<ParsedGsap, "animations"> | null,
target: { id: string | null; selector: string | null },
): ElementAnimationsOutcome {
if (!parsed) return { kind: "fetch-error" };