Skip to content

Commit de5c505

Browse files
committed
fix: call "_attach" for immediate animations
Previously, attached animations would not start their controller in response to immediate parent animation.
1 parent 3d6f0bc commit de5c505

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

packages/core/src/Controller.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,8 @@ export class Controller<State extends Indexable = any> {
500500
// Merge `from` values with `to` values
501501
this.merged = freeze({ ...from, ...to })
502502

503-
// True if any animation was updated
504-
let changed = false
503+
// All changed animations are stored here
504+
const changed: string[] = []
505505

506506
// The animations that are starting or restarting
507507
const started: string[] = []
@@ -532,7 +532,7 @@ export class Controller<State extends Indexable = any> {
532532
if (!props.reset && !isAttaching && isEqual(goalValue, currValue)) {
533533
// The animation might be stopped already.
534534
if (!state.idle) {
535-
changed = true
535+
changed.push(key)
536536
this._stopAnimation(key)
537537
}
538538
continue
@@ -623,6 +623,7 @@ export class Controller<State extends Indexable = any> {
623623
callProp(this.props.config, key) ||
624624
emptyObj
625625

626+
changed.push(key)
626627
if (!(immediate || G.skipAnimation)) {
627628
started.push(key)
628629
}
@@ -632,7 +633,6 @@ export class Controller<State extends Indexable = any> {
632633
(parent && parent.getPayload(key)) ||
633634
toArray(isInterpolated ? 1 : goalValue)
634635

635-
changed = true
636636
this.animations[key] = {
637637
key,
638638
idle: false,
@@ -656,9 +656,10 @@ export class Controller<State extends Indexable = any> {
656656
}
657657
}
658658

659-
if (changed) {
659+
if (changed.length) {
660+
this._attach(changed)
661+
660662
if (started.length) {
661-
this._attach(started)
662663
if (is.fun(onStart))
663664
each(started, key => {
664665
onStart(this.animations[key] as any)

0 commit comments

Comments
 (0)