Skip to content

Commit b48a39f

Browse files
committed
fix: try using the "loop" prop even for noop updates
But noop updates created by the "loop" prop are still never repeated.
1 parent 2a511f6 commit b48a39f

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

packages/core/src/Controller.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ export function flushUpdateQueue(
254254
*/
255255
export function flushUpdate(
256256
ctrl: Controller<any>,
257-
props: ControllerQueue[number]
257+
props: ControllerQueue[number],
258+
isLoop?: boolean
258259
): Promise<boolean> {
259260
const { to, loop, onRest } = props
260261

@@ -329,11 +330,11 @@ export function flushUpdate(
329330

330331
return Promise.all(promises).then(results => {
331332
const finished = results.every(result => result.finished)
332-
if (loop && finished && !results.every(result => result.noop)) {
333+
if (loop && finished && !(isLoop && results.every(result => result.noop))) {
333334
const nextProps = createLoopUpdate(props, loop, to)
334335
if (nextProps) {
335336
prepareKeys(ctrl, [nextProps])
336-
return flushUpdate(ctrl, nextProps)
337+
return flushUpdate(ctrl, nextProps, true)
337338
}
338339
}
339340
return finished

packages/core/src/SpringValue.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ export class SpringValue<T = any> extends FrameValue<T> {
496496
}
497497

498498
/** Schedule an animation to run after an optional delay */
499-
protected _update(props: SpringUpdate<T>): AsyncResult<T> {
499+
protected _update(props: SpringUpdate<T>, isLoop?: boolean): AsyncResult<T> {
500500
// Ensure the initial value can be accessed by animated components.
501501
const range = this._prepareNode(props)
502502

@@ -508,10 +508,10 @@ export class SpringValue<T = any> extends FrameValue<T> {
508508
this._merge(range, props, resolve)
509509
},
510510
}).then(result => {
511-
if (props.loop && result.finished && !result.noop) {
511+
if (props.loop && result.finished && !(isLoop && result.noop)) {
512512
const nextProps = createLoopUpdate(props)
513513
if (nextProps) {
514-
return this._update(nextProps)
514+
return this._update(nextProps, true)
515515
}
516516
}
517517
return result

0 commit comments

Comments
 (0)