Repository navigation
fix: keep looping async chains alive after a declarative reissue - #2661
charan-rathore wants to merge 1 commit into
Conversation
Loop continuation after an async to chain is now decided by the chain's own result instead of the combined result of every promise in the update. The per-key preparation updates settle with finished: false when a reissue lets the new chain interrupt them, which previously vetoed the loop and stopped the animation after its first pass. The combined result still governs the returned promise and onResolve. Resolves pmndrs#2095
🦋 Changeset detectedLatest commit: 24546d6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Respectfully, have you actually looked at anything you've just submitted here? Or did you just open the PR after AI wrote the code? |
|
thanks for finding where this goes wrong. the loop decision in #2674 goes one step further: for an async for next time:
|
Why
Resolves #2095
A spring with
loop: trueand an asynctosequence stops looping when adeclarative render reissues the same props mid-sequence, for example when the
consuming element mounts late. The animation plays once and then goes idle
instead of looping.
What
In
flushUpdate, loop continuation after an asynctochain is now decidedby the chain's own result, not by the combined result of every promise in the
update.
The combined result also covers the per-key preparation updates, which carry
no
toof their own. When a reissue lets the new chain's steps interruptthem, they settle with
finished: false, which only means they were replacedby their own successor. Treating that as "the chain did not finish" wrongly
vetoes the loop.
The combined result still governs the returned promise and
onResolve. Inthe tested bounded case (a reissued chain with a finite loop count), that
promise resolves
finished: trueonce the replacement chain completes, wherethe stalled base resolved
finished: false. That outcome change is theintended effect of the fix. An unbounded loop keeps running until an explicit
stop or cancel, unchanged.
Explicit stops are unchanged:
stop(true), globalstop(), and thecancelprop still end the loop exactly as before.
One deliberate behavior change beyond the stall fix: stopping a single key
without cancel (
ctrl.stop(false, 'width')) during a reissued chain nowbehaves the same as it already did for a chain that was never reissued - the
chain keeps looping, because a key-level stop never cancelled the async chain.
Before this change, a reissued chain would stall entirely instead. Global
stops and true cancels are untouched.
New regression tests: 8 asserted cases covering reissue during the first and
second sequence steps, cancellation, pause and resume, and an explicit
loop: falseoverride. A further 11 observational cases record the existingstop semantics on both sides of the change (base and patched), confirming
which behaviors moved and which did not.
Validation
Official repository tree at the current
nexthead (83e4760), pnpm frozenlockfile, Node 24, pnpm 12.14.0, Vitest browser mode with Chromium 156,
TypeScript 7.0.2:
pnpm build: 9/9 tasks.tsc --noEmit: 0 errors (run after build, per repo ordering).pnpm lint: 0 errors, 95 warnings, identical to the unpatched baseline.files on the unpatched base give 2 failures / 17 passes, and the 2 failures
are the loop-stall regressions.
Not run: the documentation site build and demos (no docs or demo changes in
this PR). No public API or dependency changes.
Checklist