Skip to content

Commit 43e8ef5

Browse files
committed
fix: create/remove springs when useSprings length argument is changed
Reported here: https://github.com/react-spring/react-spring/issues/642\#issuecomment-575952515
1 parent 0208040 commit 43e8ef5

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

packages/core/src/useSprings.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ export function useSprings(
7171
): any {
7272
const propsFn = is.fun(props) && props
7373

74-
if (propsFn && arguments.length < 3) {
75-
deps = [] // Skip updates after first render.
76-
}
77-
7874
// The "ref" prop is taken from the props of the first spring only.
7975
// The ref is assumed to *never* change after the first render.
8076
let ref: RefObject<SpringHandle> | undefined
@@ -109,7 +105,7 @@ export function useSprings(
109105
}
110106
}
111107
}
112-
}, deps)
108+
}, (deps || []).concat(length))
113109

114110
const api = useMemo(
115111
(): SpringHandle => ({

0 commit comments

Comments
 (0)