Skip to content

Commit afac367

Browse files
committed
fix: stop merging default pause/cancel in scheduleProps
The `SpringValue#_update` method does it for us now.
1 parent 2174189 commit afac367

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

packages/core/src/scheduleProps.ts

+2-19
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ export function scheduleProps<T extends AnimationTarget>(
3939
let delay: number
4040
let timeout: Timeout
4141

42-
let cancel = mergeDefaultProp(defaultProps, props, 'cancel')
43-
cancel = matchProp(props.cancel ?? cancel, key)
44-
42+
let cancel = matchProp(props.cancel ?? defaultProps?.cancel, key)
4543
if (cancel) {
4644
onStart()
4745
} else {
@@ -51,7 +49,7 @@ export function scheduleProps<T extends AnimationTarget>(
5149
}
5250
// The default `pause` takes precedence when true,
5351
// which allows `SpringContext` to work as expected.
54-
let pause = mergeDefaultProp(defaultProps, props, 'pause')
52+
let pause = defaultProps?.pause
5553
if (pause !== true) {
5654
pause = state.paused || matchProp(pause, key)
5755
}
@@ -101,18 +99,3 @@ export function scheduleProps<T extends AnimationTarget>(
10199
}
102100
})
103101
}
104-
105-
/** Update and return the default prop. */
106-
function mergeDefaultProp<T>(
107-
defaultProps: DefaultProps<T> | undefined,
108-
props: DefaultProps<T>,
109-
key: keyof DefaultProps<T>
110-
) {
111-
let value: any
112-
return (
113-
defaultProps &&
114-
(is.und((value = getDefaultProp(props, key)))
115-
? defaultProps[key]
116-
: (defaultProps[key] = value))
117-
)
118-
}

0 commit comments

Comments
 (0)