Skip to content

Bug: useSprings v9 fails to animate changing deps, report with a fix #714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bebbi opened this issue Jun 22, 2019 · 2 comments
Closed

Bug: useSprings v9 fails to animate changing deps, report with a fix #714

bebbi opened this issue Jun 22, 2019 · 2 comments
Assignees
Labels
kind: bug Something isn't working
Milestone

Comments

@bebbi
Copy link

bebbi commented Jun 22, 2019

🐛 Bug Report

This sandbox should animate changed item heights every 2 seconds but it doesn't. A working fix is provided below.

To Reproduce

Check out sandbox, see how items stay static

Expected behavior

In the same sandbox, rename the useSprings hook call inside DraggableList to useSpringsFixed which is already imported.
--> Items now correctly change position every 2s.
The fix is based on a suggestion by @drcmda but my understanding is that v9 should correctly animate this without further code.

Link to repro (highly encouraged)

Sandbox above

Environment

  • react-spring v9.0.0-beta.23
@bebbi bebbi added the kind: bug Something isn't working label Jun 22, 2019
@aleclarson
Copy link
Contributor

Here's the problem line:

const [springs, setSprings] = useSprings(items.length, fn(order, height), [items, height])

The fn function returns a function, which is only ever called once (on mount). We should probably change it to work with the deps argument.

I'll fix this when I get around to finishing and merging #670

@aleclarson aleclarson added the v9 label Jun 24, 2019
@aleclarson aleclarson added this to the v9.0.0 milestone Jun 24, 2019
@aleclarson aleclarson self-assigned this Jul 2, 2019
@aleclarson
Copy link
Contributor

This will be fixed by #808

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants