feat(sdk,studio): ws-1.1 — add set method to GsapTweenSpec; route addGsapAnimation(set) through sdk#1497
Conversation
…GsapAnimation(set) through sdk Co-authored-by: Miguel Ángel <miguel07alm@protonmail.com>
vanceingalls
left a comment
There was a problem hiding this comment.
Summary of intent. Widens GsapTweenSpec.method from "from" | "to" | "fromTo" to also include "set", and removes the method !== "set" short-circuit that was previously routing set operations to the server. The Studio hook now also conditionally emits duration/ease/fromProperties based on method — set doesn't carry duration/ease, fromTo is the only method that ships fromProperties. Pure type-narrowing relaxation; no new logic at the SDK boundary.
PR-template flag. Boilerplate only. For nine lines of code that's fine, but the why is non-obvious without context — the original method !== "set" carve-out implied the writer couldn't handle set. A one-liner explaining "writer already supports set; the carve-out was load-bearing only on the SDK's type signature" would save the next archeologist a half-hour audit.
Dispatch chain audit (the question I was charged with). Every consumer of GsapTweenSpec.method and the underlying writer paths checked:
packages/sdk/src/engine/mutate.ts:611(handleAddGsapTween) — writesmethod: tween.methodthrough toaddAnimationToScript. Already conditionally omitsduration/ease/fromPropertieswhen undefined, soset's missing-duration shape composes correctly.packages/core/src/parsers/gsapWriterAcorn.ts:36—if (anim.method !== "set" && anim.duration !== undefined). ✓ aware.packages/core/src/parsers/gsapParser.ts:1285, 2050— both gate onmethod === "set". ✓packages/core/src/parsers/gsapSerialize.ts:12, 270, 292, 325—GsapMethodalready includes"set". ✓packages/core/src/parsers/gsapParserAcorn.ts:24, 984, 998—GSAP_METHODSincludes"set"; the reader treatsmethod === "set"as zero-duration. ✓packages/core/src/lint/rules/gsap.ts:127, 182— both rules already handlemethod === "set". ✓packages/core/src/compiler/compositionScoping.ts:404, 435—setis enumerated alongsideto/from/fromTo. ✓packages/core/src/studio-api/routes/files.ts:354— server-side route'smethodunion already includes"set". ✓
Verdict on the audit: clean. The PR is exactly what it looks like — the SDK's type was the only laggard in a corpus that already understood set from day one. Nothing downstream gets caught unaware.
One observation worth noting (not a blocker). The new conditional spread at useGsapAnimationOps.ts:138-140 — ...(method !== "set" ? { duration, ease: "power2.out" as const } : {}) and the parallel fromProperties spread — is the right shape but introduces three method-keyed branches in a single 8-line block. If a fifth GSAP method ever arrives, this is the spot that will need a third edit. Not actionable today; flagging the surface.
CI. Preflight + preview-regression failing, presumably inherited from #1496 below. Worth confirming once the stack settles.
Verdict. Clear-with-nits, modulo CI green. The dispatch chain is genuinely uniform — this PR was the only place where set had been carved out, and the carve-out is correctly retired.
Cleared SHA: cffb15ba. Any push past that voids this review.
Review by Via

What
Brief description of the change.
Why
Why is this change needed?
How
How was this implemented? Any notable design decisions?
Test plan
How was this tested?