Skip to content

Commit 460c0e7

Browse files
drcmdaaleclarson
authored andcommitted
fix global configs, fix one-time prop-fn's
1 parent 4adc0ec commit 460c0e7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/core/src/useSpring.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { useSprings } from './useSprings'
2-
import { callProp } from 'shared'
2+
import { is } from 'shared'
33

44
/** API
55
* const [props, set, cancel] = useSpring(props, [optionalDeps])
66
* const [props, set, cancel] = useSpring(() => props, [optionalDeps])
77
*/
88

99
export const useSpring = (props, deps) => {
10-
const [result, set, stop] = useSprings(1, [callProp(props)], deps)
10+
const isFn = is.fun(props)
11+
const [result, set, stop] = useSprings(1, isFn ? props : [props], deps)
1112
return [result[0], set, stop]
1213
}

packages/core/src/useTransition.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const makeConfig = props => {
2626

2727
export function useTransition(input, keyTransform, props) {
2828
// Coerce props to an object
29-
props = callProp(props)
29+
props = useMemo(() => callProp(props), [])
3030
props = makeConfig({
3131
...props,
3232
items: input,

0 commit comments

Comments
 (0)