Skip to content

fix(lint): flag repeated fromTo state leaks - #3699

Merged
miga-heygen merged 2 commits into
mainfrom
magi/fix-fromto-immediate-render
Sep 8, 2026
Merged

fix(lint): flag repeated fromTo state leaks#3699
miga-heygen merged 2 commits into
mainfrom
magi/fix-fromto-immediate-render

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

What

Lint now warns when repeated future fromTo calls can leak the last authored start state into earlier frames. Explicit immediateRender: false and an earlier timeline baseline remain clean.

Why

GSAP applies default fromTo start values while the timeline is built, before the tween's scheduled position. When several calls target the same element, the last authored start state can become visible before the first tween, while existing lint reports no cause.

A standalone gsap.set is not accepted as proof of safety. An earlier global set can be overwritten by later fromTo construction, and a set for unrelated properties does not establish the affected state. The warning therefore clears only for explicit opt-out or an earlier tl.set baseline that participates in deterministic timeline seeking.

How

  • Preserve immediateRender as explicit true, explicit false, or the GSAP method default.
  • Group default or explicitly immediate-rendered fromTo writers by stable selector.
  • Require an earlier timeline set for that selector, or explicit immediateRender: false on the repeated writers.
  • Keep render seeking and GSAP runtime behavior unchanged.

Test plan

  • GSAP lint suite: 175 tests passed.
  • Regression cases cover omitted options, explicit false, earlier timeline baseline, earlier standalone set, unrelated standalone properties, later standalone set, deferred callback set, and late timeline baseline.
  • Lint package typecheck passed.
  • Changed-file oxlint, formatting, and diff checks passed.
  • Manual testing performed (not applicable; lint-only behavior).
  • Documentation updated (not applicable).

@miga-heygen miga-heygen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repeated fromTo state leak detection with proper tri-state immediateRender tracking. 10 test cases covering baselines, standalone sets, source ordering, and deferred callbacks. — Miga

@miga-heygen
miga-heygen merged commit e1ff7e6 into main Sep 8, 2026
55 checks passed
@miga-heygen
miga-heygen deleted the magi/fix-fromto-immediate-render branch September 8, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants